styled-components
6.6.0 · 12 Oct 2026MIT14.8M / weekRepositoryHomepagenpmAtom feed
3.4.10 is the newest release of 3.x.
Release note
Fixes
SSR accumulating non-critical CSS
If you've noticed that v3.2 would cause your server-side rendered app to output all styles it knows of, you weren't alone!
The ServerTag was accidentally cloning itself incorrectly. This meant that the ServerStyleSheet would inherit the same server styles from the “master” StyleSheet.
We now clone the tag correctly and a test is in place to ensure this doesn't happen again, since this bug came up a couple of times in past v2 releases. Thanks to @DeividasK for reporting this bug!
Fix at-rules nested inside style rules
Have some styles gone missing? In the newer >=3.1 versions that introduced speedy mode (i.e. insertRule support) some rules might not have been injected properly. This came down to insertRule being more strict with what we add. In development an incorrectly formatted CSS rule might not cause much trouble, but in production insertRule complains about it.
Stylis, more specifically stylis-rule-sheet, was generating invalid CSS when at-rules were nested inside style rules. For instance the following CSS would cause trouble:
/* input */
&:hover {
@media (min-width: 768px) { color: papayahwip; }
}
/* incorrect output */
@media (min-width: 768px) {
&:hover { color: papayahwip; }
}}
/* ^ note the extra closing curly brace */
/* v3.2.2 fixed output */
@media (min-width: 768px) {
&:hover { color: papayahwip; }
}Fix imprecise IS_BROWSER detection
Before v3.2.2 we would check whether styled-components is running inside the browser using: typeof window !== 'undefined'. This proofed insufficient in a couple of special cases for some people, so we have now added 'HTMLElement' in window to this check.
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.