Packages

styled-components

6.6.0 · 12 Oct 2026MIT14.8M / weekRepositoryHomepagenpmAtom feed

Upgrading styled-components From 4.4.0 to 6.6.0

75 releases in betweennotes for 72

Reading releases, release notes and advisories…

Other targets from 4.4.0Newest 4.x4.4.1
  1. 4.4.0yours
  2. 1 release
  3. 5.0.0major
  4. 19 releases
  5. 6.0.0major
  6. 18 releases
  7. 6.1.9security
  8. 24 releases
  9. 6.4.0breaking
  10. 8 releases
  11. 6.6.0target
  12. 4 pre
11+
changes to make
0
advisories fixed
39+
new
112+
fixes

Counted from 72 of 75 release notes. Advisories are counted from the advisory database, in full.

Start here

Before you upgrade

Tick each one off as you go
  • Breaking6.4.0
  • Breaking6.0.0
  • Breaking6.0.0
  • Breaking6.0.0
  • Breaking6.0.0
  • Breaking6.0.0
  • Breaking6.0.0
  • Breaking6.0.0
  • Breaking6.0.0
  • Breaking5.0.0

Security

  • Upgrading babel dependencies to latest to fix CVE-2023-45133

    6.1.9

Release by release

  1. 6.6.0

    12 Oct 20262 new · 11 fixes
    • New

      Added a StyledComponent<Target, Props> type for annotating explicitly-typed styled component exports.

    • New

      Added a development-only warning for when the server and the browser are running different versions of styled-components. Class names are derived in part from the library's own version, so a mismatch made every server-rendered class name silently fail to match on the client, with no hint as to why styles disappeared or hydration broke. The warning names both versions and points at npm ls styled-components to find the duplicate. A page that intentionally hosts more than one app, each on its own styled-components version (for example a micro-frontend setup), can ignore it. It is stripped from production builds.

    • Fixed

      Fixed attrs no longer applying its value when a prop was explicitly passed as undefined (the 6.3.12 to 6.5.x behavior). styled.button.attrs(({ type = 'button', ...rest }) => ({ type, ...rest })) rendered without type="button" when the caller passed type={undefined}, and an object-form default such as .attrs({ type: 'button' }) was lost the same way, including through a wrapper component that spreads its own props over the styled component. attrs now always wins for the keys it returns, matching every other case where a prop is passed alongside attrs.

    • Fixed

      Rendering styled-components on the server with the edge runtime (for example export const runtime = 'edge' in a Next.js route) now fails with a clear message that names the fix: use the Node.js runtime for routes that render styled-components. Previously the same setup ended in an obscure crash, either at next build or on the first request.

  2. 6.5.3

    15 Aug 20261 fix
    • Fixed

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

  3. 6.5.2

    11 Aug 20263 fixes
    • Fixed

      .attrs() is cheaper to type-check.

    • Fixed

      Explicitly annotated styled components type-check faster.

    • Fixed

      styled() wrapping a generic polymorphic component keeps its declared props narrow.

  4. 6.5.1

    7 Aug 20263 fixes
    • Fixed

      Fix a styled component silently dropping props declared as a union whose members have no prop in common, which left every one of those props rejected. The same applied when as pointed at a component with such props. Where every member's props are optional the union is still flattened, so declare the combined optional shape instead.

    • Fixed

      Styled components now report the same debug value to React DevTools on every render. Previously the value was only reported on renders that recomputed styles, so it disappeared from the DevTools panel whenever a component re-rendered with unchanged style props.

    • Fixed

      Fix wrapping a component whose props are a union. Since 6.5.0 the wrapped version accepted only the props common to every member of the union, so a prop belonging to just one member was rejected even though the unwrapped component accepted it.

  5. 6.5.0

    4 Aug 20263 new · 2 fixes
    • New

      React Native components now check style against React Native's own style types. Web-only CSS such as float, and CSS custom properties such as --brand, were previously accepted even though React Native has never done anything with them at runtime. They now surface as a type error where you write them instead of silently doing nothing.

    • New

      Declaring your own style prop type now constrains the fields you name while leaving the rest of CSS alone. Previously a declaration like styled.div<{ style?: { width: number } }> was quietly ignored, because the built-in style type was applied after your props, so any CSS value was still accepted. Now width has to be a number, while color, custom properties, and everything else you did not mention keep working as before.

    • New

      Large TypeScript projects type-check dramatically faster. On a 500-component app, tsc check time drops to under a quarter of what 6.4.4 takes and peak memory to under a third, which resolves the out-of-memory failures some projects hit after upgrading past 6.4.2. Both are now better than 6.4.2 was, so there is no longer a reason to pin to it. Editor responsiveness improves by the same margin, and autocomplete on as targets is unchanged.

    • Fixed

      Fixed ref being rejected on React Native components created with the shorthand syntax, such as styled.TextInput. Passing a ref, or a ref callback whose parameter you have not annotated, now works the same way it does with styled(TextInput).

    • Fixed

      Fixed components built on targets whose props cannot be inspected, such as Mantine's polymorphic components, rejecting children and the target's own props once you added a prop of your own:

  6. 6.4.4

    18 Jul 20261 fix
    • Fixed

      Reduce TypeScript type-checking cost for styled components, most noticeably styled(Component) wrappers and polymorphic as usage. Large codebases that saw elevated tsc memory and type-instantiation counts get lower type-check memory and time, with no change to the emitted types or runtime behavior.

  7. 6.4.3

    24 Jun 20262 fixes
    • Fixed

      Fix a TypeScript error when wrapping a component whose props can't be statically read, such as Mantine v7's polymorphic-factory components (Button, Card, Menu.Item, and similar). These styled components no longer reject every prop, including children; arbitrary props are accepted again at the JSX call site and via .attrs(), while components with readable prop types stay fully type-checked.

    • Fixed

      Keep TypeScript attribute autocomplete working while you type props on a polymorphic styled component. When a component renders a different element through as (for example as="video"), beginning to type a new prop name could make the whole suggestion list vanish; the rendered element's props now keep autocompleting as you go.

  8. 6.4.2

    19 May 20265 fixes
    • Fixed

      Restore TypeScript prop autocomplete inside the JSX of a styled component once the first attribute is typed.

    • Fixed

      Apply all chain levels' styles when an extended styled component renders with the as prop under Preact's react-compat.

    • Fixed

      Respect a custom toString on plain value objects (e.g. design tokens) when interpolated into a styled component, rather than walking the object's keys as CSS declarations.

    • Fixed

      Fix a TypeScript error when wrapping a component whose props include an as prop with a non-string type (such as Next.js Link's as?: Url). The styled component now accepts either the styled-components polymorphism value or the wrapped component's own as type, so spreading the wrapped component's props onto the styled component is assignable again.

    • Fixed

      Restore reliable styling in production browser bundles built without a runtime process global.

25 other lines we could not sort, mostly version bumps
  • Replace deprecated global JSX namespace

    6.1.13
  • Export rehydrate from StyleSheet

    6.1.12
  • Export IStyledComponentBase interface

    6.1.10
  • Revert type changes introduced in #4288 due to a large number of bug reports

    6.1.10
  • Drop displayName in production to save bytes, it's already present in the static className if you're using the babel plugin or equivalent

    6.0.2
  • Refactor use of flatMap and at with ES5-compliant variants

    6.0.2
  • Reduced some sources of unnecessary branching logic

    6.0.0
  • Make styled components work when the Object prototype is frozen

    5.3.9
  • Backport #3568 (read from textContent rather than innerHTML during rehydrate) to v5

    5.3.3
  • Generate more complete sourcemaps

    5.3.3

12 internal lines (docs, tests, tooling) left out.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.