npm install. Only major versions have the potential to introduce breaking changes (noted in the following release notes).// (e.g. URLs) causing subsequent styles to not be applied.createGlobalStyle styles not being removed when unmounted in RSC environments. React 19's precedence attribute on style tags makes them persist as permanent resources; global styles now render without precedence so they follow normal component lifecycle.theme is now undefined instead of {} for styled components, matching the existing behavior of withTheme and createGlobalStyle. This ensures accessing theme properties without a ThemeProvider correctly throws rather than silently returning undefined.withTheme HOC types: ref now correctly resolves to the component instance type instead of the constructor, and theme is properly optional in the wrapped component's props.exports field and restore browser/server build split with browser field in package.json. Fixes require('stream') resolution errors in browser bundlers like webpack 5.51ffa9c: Fix createGlobalStyle compatibility with React StrictMode and RSC
This fix addresses issues where global styles would disappear or behave incorrectly in React StrictMode and RSC:
Static styles optimization: Static global styles (without props/interpolations) are now only injected once and won't be removed/re-added on every render. This prevents the style flickering that could occur during concurrent rendering.
StrictMode-aware cleanup: Style cleanup now uses queueMicrotask to coordinate with React's effect lifecycle. In StrictMode's simulated unmount/remount cycle, styles are preserved. On real unmount, styles are properly removed.
RSC compatibility: Move useRef inside RSC guard in createGlobalStyle and unify all useContext calls to use consistent !IS_RSC ? pattern.
RSC inline style tag cleanup: Fix bug where server-defined createGlobalStyle rendered in client components would leave behind accumulated SSR-rendered inline <style data-styled-global> tags. The cleanup effect now removes these hoisted style tags when the component unmounts or re-renders with different CSS.
These changes ensure createGlobalStyle works correctly with:
precedence attribute51ffa9c: Restore styled.br.
1f794b7: Add package.json "exports" field for better native ESM integration.
// (e.g., url(https://example.com)). The // in protocol URLs like https://, http://, file://, and protocol-relative URLs was incorrectly being treated as a JavaScript-style line comment.7ff7002: Fix: Line comments (//) in multiline CSS declarations no longer cause parsing errors (fixes #5613)
JS-style line comments (//) placed after multiline declarations like calc() were not being properly stripped, causing CSS parsing issues. Comments are now correctly removed anywhere in the CSS while preserving valid syntax.
Example that now works:
const Box = styled.div`
max-height: calc(100px + 200px + 300px); // This comment no longer breaks parsing
background-color: green;
`;7ff7002: Fix: Contain invalid CSS syntax to just the affected line
In styled-components v6, invalid CSS syntax (like unbalanced braces) could cause all subsequent styles to be ignored. This fix ensures that malformed CSS only affects the specific declaration, not subsequent valid styles.
Example that now works:
const Circle = styled.div`
width: 100px;
line-height: ${() => '14px}'}; // ⛔️ This malformed line is dropped
background-color: green; // ✅ Now preserved (was ignored in v6)
`;createGlobalStyle to not use useLayoutEffect on the server, which was causing a warning and broken styles in v6.3.x. The check typeof React.useLayoutEffect === 'function' is not reliable for detecting server vs client environments in React 18+, so we now use the __SERVER__ build constant instead.6e4d1e7: fix: suppress false "created dynamically" warnings in React Server Components
The dynamic creation warning check now properly detects RSC environments and skips validation when IS_RSC is true. This eliminates false warnings for module-level styled components in server components, which were incorrectly flagged due to RSC's different module evaluation context. Module-level styled components in RSC files no longer trigger warnings since they cannot be created inside render functions by definition.
a4b4a6b: fix: include TypeScript declaration files in npm package
Fixed Rollup TypeScript plugin configuration to override tsconfig.json's noEmit setting, ensuring TypeScript declaration files are generated during build.
a4b4a6b: fix: resolve TypeScript error blocking type declaration emission
Fixed TypeScript error in StyledComponent when merging style attributes from attrs. Added explicit type cast to React.CSSProperties to safely merge CSS property objects. This error was preventing TypeScript declaration files from being generated during build.
28fd502: Add React Server Components (RSC) support
styled-components now automatically detects RSC environments and handles CSS delivery appropriately:
'use client' directive required: Components work in RSC without any wrapper or directive<style> tags that React 19 automatically hoists and deduplicatesServerStyleSheet continue to work unchangedRSC best practices:
&[data-size='lg'])style, and cascade to children:const Container = styled.div``;
const Button = styled.button`
background: var(--color-primary, blue);
`;
// Variables set on parent cascade to all DOM children
<Container style={{ '--color-primary': 'orchid' }}>
<Button>Inherits orchid background</Button>
</Container>;ThemeProvider is a no-op in RSCTechnical details:
typeof React.createContext === 'undefined'ThemeProvider and StyleSheetManager become no-ops in RSC (children pass-through)856cf06: feat: update built-in element aliases to include modern HTML and SVG elements
Added support for modern HTML and SVG elements that were previously missing:
HTML elements:
search slot template SVG filter elements:
fe* filter primitive elements (feBlend, feColorMatrix, feComponentTransfer, etc.)clipPath, linearGradient, radialGradient textPath switch, symbol, use This ensures styled-components has comprehensive coverage of all styleable HTML and SVG elements supported by modern browsers and React.
418adbe: fix(types): add CSS custom properties (variables) support to style prop
CSS custom properties (CSS variables like --primary-color) are now fully supported in TypeScript without errors:
.attrs({ style: { '--var': 'value' } }) <Component style={{ '--var': 'value' }} /> aef2ad6: Update shared css property handling tools to latest versions.
c3a5990: Update csstype dependency from 3.1.3 to 3.2.3
This updates the pinned csstype dependency from 3.1.3 to 3.2.3 to fix a type incompatibility with @types/react.
DefaultTheme type definitionExoticComponentWithDisplayName API from React.Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.12...v6.1.13
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.11...v6.1.12
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.10...v6.1.11
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.9...v6.1.10
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.8...v6.1.9
Revert adding peerDependencies from v6.1.7; apparently some package managers have differing behaviors around peerDependenciesMeta[package].optional which is causing issues. Will revisit at a later date if possible.
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.7...v6.1.8
chore: add all missing peer dependency statements by @quantizor in https://github.com/styled-components/styled-components/pull/4243
NOTE: this change may cause some installed dependency duplication until this NPM bug is addressed but yarn and pnpm have correct behavior. Bun also has a similar bug.
Overall these changes ensure that styled-components is specifying a known working version of all utilized libraries, while instructing the client package manager that higher semver-compliant versions are permissible and should work, assuming the relevant libraries are compliant in practice.
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.6...v6.1.7
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.5...v6.1.6
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.4...v6.1.5
attrs to provide a custom theme prop to child components by @quantizor in https://github.com/styled-components/styled-components/pull/4242Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.3...v6.1.4
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.2...v6.1.3
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.1...v6.1.2
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.1.0...v6.1.1