styled-components lets you write component styles as tagged template literals with scoped CSS. The same API works in client components, server components, streaming SSR, and React Native.
Overview
The library attaches real CSS to React components without separate stylesheets or manual class juggling. Styles can depend on props, compose through extension, swap underlying elements via an as prop, and use nesting, pseudo-selectors, media queries, and keyframe animations.
TypeScript types ship with the package, including prop-driven style inference. Theming passes design tokens through React context, with helpers to expose tokens as CSS variables for server rendering without hydration mismatches.
Server components can register style plugins globally for an app layout, while client subtrees can use a style sheet manager. Optional vendor-prefix plugins replace older global prefix toggles. Documentation covers React Server Components, SSR, React Native, and third-party components that accept className.
Key features
- Scoped CSS via template literals
- Server components and streaming SSR
- React Native shared API
- Props-driven dynamic styles
- Theme context and createTheme tokens
- Keyframes and global style helpers
- TypeScript-included typings
- Opt-in vendor prefix plugins
Use cases
- Component libraries with co-located styles
- Themed marketing or product sites
- Isomorphic React apps with SSR
- Cross-platform React Native UIs