styled-components-emotion
/styled-components-emotion
Porządkuje style komponentów w styled-components lub Emotion, z dynamicznymi motywami i abstrakcjami CSS-in-JS.
- Autor
- nextboxis ↗
- Repozytorium
- library-skill-agents ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 28.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 28.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Porządkuje style komponentów w styled-components lub Emotion, z dynamicznymi motywami i abstrakcjami CSS-in-JS.
Oryginalny opis (EN)
Use this skill when managing component-scoped styles, dynamic theme props, and CSS-in-JS abstractions using styled-components or Emotion.
Jak działa
- When to use
- Prerequisites
- Step-by-step workflow
- Commands / code examples
- Common mistakes & pitfalls
- Verification checklist
- Related skills
Podgląd SKILL.md
---
name: styled-components-emotion
description: Use this skill when managing component-scoped styles, dynamic theme props, and CSS-in-JS abstractions using styled-components or Emotion.
---
# Styled Components and Emotion
## When to use
Use this skill when developing design systems and dynamic React applications requiring runtime theme switching, prop-driven styling, and CSS-in-JS encapsulation.
## Prerequisites
- Node.js 18+ and `styled-components` or `@emotion/react` / `@emotion/styled` installed.
- Babel/SWC plugins configured for server-side rendering (SSR) style extraction.
## Step-by-step workflow
1. **Configure SSR style registry**: Ensure the server-side style sheet collector (e.g., `ServerStyleSheet` or Emotion Cache) injects styles on SSR passes.
2. **Define ThemeProvider**: Wrap root component with `ThemeProvider` delivering strongly typed design tokens.
3. **Author styled primitives**: Create styled tags with tagged template literals or object styles utilizing prop interpolation.
4. **Extend existing components**: Apply `styled(ExistingComponent)` to wrap and augment third-party or custom components with new styles.
5. **Optimize runtime rendering**: Extract static style declarations outside render functions to avoid recreating component definitions every frame.
## Commands / code examples
```tsx
import styled from 'styled-components';
interface ButtonProps {
$variant?: 'primary' | 'danger';
$fullWidth?: boolean;
}
export const StyledButton = styled.button<ButtonProps>`
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.5rem 1rem;
border-radius: ${(props) => props.theme.radii.md};
font-weight: 600;
width: ${(props) => (props.$fullWidth ? '100%' : 'auto')};
transition: opacity 0.2s ease;
background-color: ${(props) =>
props.$variant === 'danger'
? props.theme.colors.danger
: props.theme.colors.primary};
color: #ffffff;
border: none;
cursor: pointer;
&:hover {
opacity: 0.9;
}
&:focus-visible {
outline: 2px solid ${(props) => props.theme.colors.focus};
outline-offset: 2px;
}
`;
```
## Common mistakes & pitfalls
- Defining styled components inside a React component render function, causing recreation and loss of input focus on every re-render.
- Passing raw props directly to the DOM without using transient props (prefixed with `$`), causing invalid HTML attribute warnings.
- Missing SSR style extraction setup, leading to Flash of Unstyled Content (FOUC).
## Verification checklist
- [ ] Styled components are defined at file-level scope outside render functions.
- [ ] Transient props (`$propName`) prevent custom styling props from leaking into DOM attributes.
- [ ] Design tokens are accessed via `theme` context rather than hardcoded hex values.
- [ ] SSR style hydration produces zero FOUC on initial page load.
## Related skills
- react-fundamentals
- react-state-management
- css-modules-and-sass
- tailwindcss-architecture
Wersje
W bazie nie ma innych skilli o nazwie styled-components-emotion.
Migawka bazy z 13.11.2026 · wersja paczki 76dffde82747 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 95emotion-migrate
Migruje styled-components z Emotion do komponentów Mantine ze style props i modułami CSS, przy konwersji plików .styled.tsx i usuwaniu importów @emotion. - 100devup-ui
Pomaga wdrożyć bibliotekę Devup UI, czyli CSS-in-JS bez narzutu w runtime, z konfiguracją motywu i migracją ze styled-components. - 100css-ninja
Pomaga w CSS z Tailwind, CSS-in-JS, układami responsywnymi, animacjami i trybem ciemnym: Grid, Flexbox, styled-components, emotion i architektura BEM lub utility-first. - 100styled-components-helper
Wspiera pracę ze styled-components w ramach automatycznie aktywowanej kategorii Frontend Development, reagując na frazy związane z pomocnikiem styled components. - 90frontend-css-strategy
Dobiera podejście do CSS, np. moduły, CSS-in-JS czy Tailwind, według wielkości projektu, zespołu i wydajności. - 100migrate-styled-components-to-vanilla-extract
Prowadzi krok po kroku migrację projektu ze styled-components do vanilla-extract, w tym pliki .css.ts, usunięcie zależności i eksport ./bundle.css.