unstale

npm / styled-components

styled-components

What changed in styled-components 6, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-17.

9 breaking1 security1 deprecations9 new APIs and options9 performance7 behavior and defaults2 tooling50 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.1.1 on npm

styled-components 688 changes

Breaking changes 9

  • 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.0release notes

  • 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.0release notes

  • Wrapping a generic polymorphic component now keeps its declared props narrow, catching invalid prop values as the direct component does.

    6.5.2release notes

  • 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.0release notes

  • 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.0release notes

  • CSS injection order is determined at definition time rather than render order; keyframes defined before a component appear before its rules.

    6.4.0release notes

  • IE11 support is dropped and the build target is now ES2015.

    6.4.0release notes

  • In RSC environments, theme is now undefined instead of {} for styled components, so accessing theme properties without a ThemeProvider correctly throws.

    6.3.9release notes

  • ThemeProvider becomes a no-op in RSC, passing children through; build-time CSS variable generation is recommended for theming.

    6.3.0release notes

Security 1

  • 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.0release notes

Deprecations 1

  • 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.0release notes

New APIs and options 9

  • 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.0release notes

  • 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.0release notes

  • 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.0release notes

  • The prefix option sets the CSS custom property prefix and defaults to "sc".

    6.4.0release notes

  • The selector option sets the CSS variable declaration selector and defaults to ":root"; use ":host" for Shadow DOM.

    6.4.0release notes

  • Adds CSP nonce support through the StyleSheetManager prop, ServerStyleSheet constructor, supported meta tags, or the legacy __webpack_nonce__ global.

    6.4.0release notes

  • 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.0release notes

  • Adds built-in aliases for modern HTML and SVG elements, including search, slot, template, SVG filter primitives, and structural elements.

    6.3.0release notes

  • Adds experimental support for React 18+ renderToPipeableStream.

    6.2.0release notes

Performance 9

  • 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.0release notes

  • The .attrs() path requires less consumer type-check work, without changing the resulting component's accepted props.

    6.5.2release notes

  • Explicitly annotated styled components type-check faster because inline style widening now builds on React's CSSProperties.

    6.5.2release notes

  • 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.0release notes

  • Reduces type-checking memory and time, especially for styled(Component) wrappers and polymorphic as usage, without changing emitted types or runtime behavior.

    6.4.4release notes

  • 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.0release notes

  • 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.0release notes

  • Reduce standalone/browser bundle size by making IS_RSC a build-time constant, enabling dead code elimination of RSC-specific branches.

    6.3.10release notes

  • Optimized internal style-processing hot paths, including grouped tag lookups, flattening, dynamic style generation, and SSR output.

    6.3.9release notes

Behavior and default changes 7

  • 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.0release notes

  • Props supplied via attrs are automatically optional on the resulting component when attrs provides a default.

    6.4.0release notes

  • React Native is now an optional peer dependency.

    6.4.0release notes

  • 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.0release notes

  • react-dom is now an optional peer dependency, so projects using styled-components may not need to install it.

    6.3.8release notes

  • styled-components automatically detects RSC environments and delivers CSS through inline style tags, without requiring a use client directive or configuration.

    6.3.0release notes

  • StyleSheetManager becomes a no-op in RSC, passing children through.

    6.3.0release notes

Tooling 2

  • Adds an exports field to package.json for better native ESM integration.

    6.3.7release notes

  • TypeScript declaration files are now generated during the build and included in the npm package, making package types available to consumers.

    6.3.1release notesrelease notes

Fixes and other changes 50

  • 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.0release notes

  • JavaScript-style // line comments are now stripped from React Native style declarations without treating URL values as comments.

    6.6.0release notes

  • 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.0release notes

  • 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.0release notes

  • 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.0release notes

  • 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.0release notes

  • 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.0release notes

  • Fixes TypeScript errors in projects that augment React HTML props with a data-* template-literal index signature.

    6.5.3release notes

  • Styled components now report the same debug value to React DevTools on every render, including renders that do not recompute styles.

    6.5.1release notes

  • 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.1release notes

  • Wrapping a component with union props no longer restricts accepted props to those common to every union member.

    6.5.1release notes

  • 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.0release notes

  • Reading a component’s style type now reports CSS custom properties as accepted, matching the behavior when rendering.

    6.5.0release notes

  • An attrs callback with an explicit parameter type no longer produces a type error.

    6.5.0release notes

  • Refs and unannotated ref callbacks now work on React Native components created with shorthand syntax, as they do with styled(TextInput).

    6.5.0release notes

  • Attribute autocomplete on polymorphic styled components continues to suggest props for the rendered element while typing, including when using as="video".

    6.4.3release notes

  • 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.3release notes

  • Applies styles from every chain level when an extended styled component renders with the as prop under Preact's react-compat.

    6.4.2release notes

  • 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.2release notes

  • Restores reliable styling in production browser bundles that have no runtime process global.

    6.4.2release notes

  • Uses a plain value object's custom toString when interpolated, instead of walking its keys as CSS declarations.

    6.4.2release notes

  • Restores prop autocomplete inside styled-component JSX after the first attribute is typed.

    6.4.2release notes

  • Fixes significant re-render slowdowns caused by dynamic createGlobalStyle components in 6.4.0.

    6.4.1release notes

  • Restores pre-6.4 cascade ordering when multiple instances of the same createGlobalStyle coexist.

    6.4.1release notes

  • Updates messages for keyframes-in-untagged-strings and component-selector references that pointed to the old website and described v3 behavior.

    6.4.1release notes

  • React.ComponentProps extraction for styled components now exposes the as prop.

    6.4.0release notes

  • The attrs callback receives an immutable snapshot so later attrs processing cannot change its props object.

    6.4.0release notes

  • Client-side HMR re-injects static global styles when module re-evaluation changes the globalStyle reference.

    6.4.0release notes

  • React.ComponentProps extraction for styled components now exposes the forwardedAs prop.

    6.4.0release notes

  • Fixes a memory leak in long-running apps when interpolation values come from unbounded user input.

    6.4.0release notes

  • Eliminates double style rendering and unnecessary DOM queries during cleanup in client/test environments, fixing a test performance regression.

    6.3.12release notes

  • In React Native, syntax errors now log a development warning and produce an empty style object instead of crashing.

    6.3.12release notes

  • The native bundle no longer includes DOM code, fixing a crash and compatibility with RN 0.79+ and Hermes.

    6.3.12release notes

  • 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.12release notes

  • Fixes a React is not defined ReferenceError when loading the CJS build in Node.js.

    6.3.11release notes

  • 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.10release notes

  • 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.9release notes

  • 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.9release notes

  • Fixed CSS block comments containing //, such as URLs, from preventing subsequent styles from being applied.

    6.3.9release notes

  • Fixed SSR styles hydration and global style cleanup in Shadow DOM.

    6.3.9release notes

  • 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.9release notes

  • 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.7release notes

  • Restores styled.br.

    6.3.7release notes

  • Fixes unquoted URLs containing // from being incorrectly stripped, including protocol and protocol-relative URLs.

    6.3.6release notes

  • JS-style line comments after multiline CSS declarations are correctly removed, preventing CSS parsing errors.

    6.3.5release notes

  • Malformed CSS now only affects the specific declaration; subsequent valid styles are preserved.

    6.3.5release notes

  • No longer uses useLayoutEffect on the server, preventing a warning and broken styles in v6.3.x.

    6.3.4release notes

  • Module-level styled components in React Server Components no longer trigger false “created dynamically” warnings.

    6.3.3release notes

  • TypeScript now accepts CSS custom properties in style props, including in attrs and component props, alongside regular CSS properties.

    6.3.0release notes

  • Fixes a link in the console debug message that no longer exists.

    6.2.0release notes