yarn add styled-components
Changed in this version
- Compatibility with frozen Object prototype, part 2 by @jportner in #4042
- ensure useTheme hook returns theme object by @nksfrank in #4033
- revert rc.3 type changes, investigate alternate fixes by @probablyup in #4037
- finalize rc.4 inclusions by @probablyup in #4047
- object styles now have strong typing
- add dev-time warning if
enableVendorPrefixes
needs to be enabled based on prop usage
New Contributors
Breaking changes in v6
Migration guide → https://styled-components.com/docs/faqs#what-do-i-need-to-do-to-migrate-to-v6
- now using
stylis
v4 (if usingstylis-plugin-rtl
you'll need to upgrade to the newer version) - styled-components now provides its own types; if you installed
@types/styled-components
in the past, you'll want to remove it - dropped
$as
and$forwardedAs
props (useas
orforwardedAs
) - dropped automatic prop filtering; use transient props (
$
prefix) for stuff you don't want to be passed to child component / HTML StyleSheetManager
- replaced
disableVendorPrefixes
withenableVendorPrefixes
prop - dropped automatic vendor prefixing; if you need to support older browsers, you can re-enable it easily with the above prop
<StyleSheetManager enableVendorPrefixes> {/* your React tree and ThemeProvider goes here */} </StyleSheetManager>
- replaced
- dropped deprecated
withComponent
API (87f511a); use "as" prop instead - node >= 14 needed
Full Changelog: https://github.com/styled-components/styled-components/compare/v6.0.0-rc.3..v6.0.0-rc.4