# What changed in styled-components

> 88 changes in styled-components 6 from its official release notes, upgrade guides and advisories: 9 breaking, 1 deprecations, 1 security, 9 new APIs and options. Each one cited. Sources checked 2026-10-17. HTML: https://unstale.sh/npm/styled-components/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## styled-components 6

### Breaking changes

- Values returned by attrs now win when a caller explicitly passes the same prop as undefined. Explicit undefined props not overridden by attrs are forwarded to wrapped components, but not to DOM tags. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)
- Server rendering with the edge runtime now fails with a clear message directing developers to use the Node.js runtime for routes that render styled-components. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)
- Wrapping a generic polymorphic component now keeps its declared props narrow, catching invalid prop values as the direct component does. (6.5.2) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.2)
- React Native components now check style against React Native’s style types, rejecting web-only CSS and CSS custom properties that have no runtime effect. (6.5.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.0)
- With `exactOptionalPropertyTypes`, explicitly passing `style={undefined}` is rejected on components that declare their own style prop; include `undefined` in the declaration to allow it. (6.5.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.0)
- CSS injection order is determined at definition time rather than render order; keyframes defined before a component appear before its rules. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- IE11 support is dropped and the build target is now ES2015. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- In RSC environments, `theme` is now `undefined` instead of `{}` for styled components, so accessing theme properties without a ThemeProvider correctly throws. (6.3.9) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.9)
- ThemeProvider becomes a no-op in RSC, passing children through; build-time CSS variable generation is recommended for theming. (6.3.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.0)

### Security

- Instances share a stylesheet group registered at definition time, preventing one instance from removing styles needed by others and reducing SSR group ID leaks. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)

### Deprecations

- A development-only warning identifies differing server and browser versions, names both versions, and points to npm ls styled-components; it is stripped from production builds. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)

### New APIs and options

- A public type for explicitly annotating exported styled components is now exported from the web and native entries and resolves to the exact type produced by styled(Target)<Props>. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)
- Use the new helper to make a declared style type the only accepted style fields, removing fields not listed, including CSS custom properties. (6.5.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.0)
- Adds CSS variable theming across RSC and client components, returning a theme-shaped object with CSS variable values, raw values, variable names, a resolver, and a GlobalStyle component. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- The prefix option sets the CSS custom property prefix and defaults to "sc". (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- The selector option sets the CSS variable declaration selector and defaults to ":root"; use ":host" for Shadow DOM. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- Adds CSP nonce support through the StyleSheetManager prop, ServerStyleSheet constructor, supported meta tags, or the legacy __webpack_nonce__ global. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- Adds an opt-in Stylis plugin that rewrites child-index selectors to exclude injected style tags from the count; unsupported browsers drop the entire CSS rule. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- Adds built-in aliases for modern HTML and SVG elements, including search, slot, template, SVG filter primitives, and structural elements. (6.3.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.0)
- Adds experimental support for React 18+ renderToPipeableStream. (6.2.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.2.0)

### Performance

- Type-checking is faster when exported styled components have explicit types, especially for components built on intrinsic tags and wrappers over polymorphic components. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)
- The .attrs() path requires less consumer type-check work, without changing the resulting component's accepted props. (6.5.2) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.2)
- Explicitly annotated styled components type-check faster because inline style widening now builds on React's CSSProperties. (6.5.2) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.2)
- Large TypeScript projects type-check much faster and use less peak memory, resolving some out-of-memory failures after upgrading past 6.4.2. (6.5.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.0)
- Reduces type-checking memory and time, especially for styled(Component) wrappers and polymorphic as usage, without changing emitted types or runtime behavior. (6.4.4) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.4)
- A lightweight CSS declaration parser replaces postcss, fixes nanoid crashes in Expo/Metro, and improves parse speed 4–6x; unchanged-child parent re-renders are also faster. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- Client re-renders that do not change styling skip style resolution, with cross-sibling caching and hot-path optimizations; server renders are unaffected. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- Reduce standalone/browser bundle size by making IS_RSC a build-time constant, enabling dead code elimination of RSC-specific branches. (6.3.10) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.10)
- Optimized internal style-processing hot paths, including grouped tag lookups, flattening, dynamic style generation, and SSR output. (6.3.9) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.9)

### Behavior and default changes

- A developer-declared style prop type now constrains the fields it names while leaving other CSS accepted; constraints also hold through `as` and `forwardedAs`. (6.5.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.0)
- Props supplied via attrs are automatically optional on the resulting component when attrs provides a default. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- React Native is now an optional peer dependency. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- RSC-rendered styled components inject deduplicated inline style tags; extended components use zero-specificity wrapping on base CSS, and StyleSheetManager settings apply without React context. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- react-dom is now an optional peer dependency, so projects using styled-components may not need to install it. (6.3.8) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.8)
- styled-components automatically detects RSC environments and delivers CSS through inline style tags, without requiring a use client directive or configuration. (6.3.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.0)
- StyleSheetManager becomes a no-op in RSC, passing children through. (6.3.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.0)

### Tooling

- Adds an exports field to package.json for better native ESM integration. (6.3.7) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.7)
- TypeScript declaration files are now generated during the build and included in the npm package, making package types available to consumers. (6.3.1) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.2), [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.1)

### Fixes and other changes

- Global styles no longer disappear in React Server Components when rendered in a Suspense fallback and again in streamed content, or when shared by a layout and page during client-side navigation. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)
- JavaScript-style // line comments are now stripped from React Native style declarations without treating URL values as comments. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)
- The streaming API declarations no longer require a type available only in newer @types/react-dom packages; interleaveWithNodeStream retains its existing accepted inputs. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)
- Style interpolations now run on every render, keeping hooks consistent and values read inside interpolations current. React.memo can skip renders when props are unchanged and interpolations are expensive. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)
- Server-rendered component styles now travel with each instance in an inline style element, so styles survive when content is revealed from behind a Suspense boundary. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)
- Published types now compile with skipLibCheck off on supported React type versions that do not declare the search HTML element; styled.search retains its existing props. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)
- styled-components now installs the stylis type declarations its published types rely on, avoiding type-check failures when skipLibCheck is off and projects have not installed @types/stylis themselves. (6.6.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.6.0)
- Fixes TypeScript errors in projects that augment React HTML props with a data-* template-literal index signature. (6.5.3) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.3)
- Styled components now report the same debug value to React DevTools on every render, including renders that do not recompute styles. (6.5.1) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.1)
- Styled components no longer reject props declared in union members with no props in common, including when `as` points to a component with such props. Unions whose members all have optional props are still flattened. (6.5.1) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.1)
- Wrapping a component with union props no longer restricts accepted props to those common to every union member. (6.5.1) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.1)
- Targets whose props cannot be inspected no longer reject children or the target’s own props when you add a prop of your own; declared props remain strictly typed. (6.5.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.0)
- Reading a component’s style type now reports CSS custom properties as accepted, matching the behavior when rendering. (6.5.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.0)
- An `attrs` callback with an explicit parameter type no longer produces a type error. (6.5.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.0)
- Refs and unannotated ref callbacks now work on React Native components created with shorthand syntax, as they do with `styled(TextInput)`. (6.5.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.5.0)
- Attribute autocomplete on polymorphic styled components continues to suggest props for the rendered element while typing, including when using as="video". (6.4.3) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.3)
- Styled components wrapping components whose props cannot be statically read accept arbitrary props again, including children, at JSX call sites and via .attrs(), while readable prop types remain checked. (6.4.3) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.3)
- Applies styles from every chain level when an extended styled component renders with the `as` prop under Preact's `react-compat`. (6.4.2) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.2)
- Allows a styled component's `as` prop to accept either the styled-components polymorphism value or the wrapped component's own `as` type. (6.4.2) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.2)
- Restores reliable styling in production browser bundles that have no runtime `process` global. (6.4.2) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.2)
- Uses a plain value object's custom `toString` when interpolated, instead of walking its keys as CSS declarations. (6.4.2) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.2)
- Restores prop autocomplete inside styled-component JSX after the first attribute is typed. (6.4.2) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.2)
- Fixes significant re-render slowdowns caused by dynamic createGlobalStyle components in 6.4.0. (6.4.1) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.1)
- Restores pre-6.4 cascade ordering when multiple instances of the same createGlobalStyle coexist. (6.4.1) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.1)
- Updates messages for keyframes-in-untagged-strings and component-selector references that pointed to the old website and described v3 behavior. (6.4.1) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.1)
- React.ComponentProps extraction for styled components now exposes the as prop. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- The attrs callback receives an immutable snapshot so later attrs processing cannot change its props object. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- Client-side HMR re-injects static global styles when module re-evaluation changes the globalStyle reference. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- React.ComponentProps extraction for styled components now exposes the forwardedAs prop. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- Fixes a memory leak in long-running apps when interpolation values come from unbounded user input. (6.4.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.4.0)
- Eliminates double style rendering and unnecessary DOM queries during cleanup in client/test environments, fixing a test performance regression. (6.3.12) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.12)
- In React Native, syntax errors now log a development warning and produce an empty style object instead of crashing. (6.3.12) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.12)
- The native bundle no longer includes DOM code, fixing a crash and compatibility with RN 0.79+ and Hermes. (6.3.12) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.12)
- Explicitly passed `undefined` props are preserved for compatibility with libraries that use them to reset inherited defaults; `.attrs()` props set to `undefined` are still stripped. (6.3.12) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.12)
- Fixes a React is not defined ReferenceError when loading the CJS build in Node.js. (6.3.11) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.11)
- Fix RSC style tags for extended components: correct hrefs, include base CSS when only the extended component renders, and preserve base-before-extended CSS ordering for React 19 deduplication and specificity. (6.3.10) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.10)
- Restored the browser/server build split with the `browser` field in package.json, fixing `require('stream')` resolution errors in browser bundlers such as webpack 5. (6.3.9) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.9)
- Global styles are removed when unmounted in RSC environments; they render without React 19's `precedence` attribute so they follow the normal component lifecycle. (6.3.9) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.9)
- Fixed CSS block comments containing `//`, such as URLs, from preventing subsequent styles from being applied. (6.3.9) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.9)
- Fixed SSR styles hydration and global style cleanup in Shadow DOM. (6.3.9) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.9)
- The HOC's ref type now resolves to the component instance rather than the constructor, and `theme` is optional in the wrapped component's props. (6.3.9) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.9)
- Fixes global style injection and cleanup in React StrictMode and RSC, including style flickering, incorrect cleanup, and accumulated SSR-rendered inline style tags. (6.3.7) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.7)
- Restores styled.br. (6.3.7) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.7)
- Fixes unquoted URLs containing // from being incorrectly stripped, including protocol and protocol-relative URLs. (6.3.6) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.6)
- JS-style line comments after multiline CSS declarations are correctly removed, preventing CSS parsing errors. (6.3.5) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.5)
- Malformed CSS now only affects the specific declaration; subsequent valid styles are preserved. (6.3.5) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.5)
- No longer uses useLayoutEffect on the server, preventing a warning and broken styles in v6.3.x. (6.3.4) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.4)
- Module-level styled components in React Server Components no longer trigger false “created dynamically” warnings. (6.3.3) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.3)
- TypeScript now accepts CSS custom properties in style props, including in attrs and component props, alongside regular CSS properties. (6.3.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.3.0)
- Fixes a link in the console debug message that no longer exists. (6.2.0) — [release notes](https://github.com/styled-components/styled-components/releases/tag/styled-components%406.2.0)
