Primer React v38 Release: Faster, lighter, and more accessible #7086
Pinned
francinelucca
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Primer React v38 is here, a major update focused on improving performance. The highlight of this release is our move from
styled-componentsto CSS Modules, which reduces JavaScript bundle sizes and enhances both client and server-side rendering performance.✨ What's New
The following component has been promoted from
@primer/react/experimentalto@primer/react:Other updates:
gapprop for customizable spacing between itemsactionsLayoutprop to handle actions layout edge casesoverrideButtonFocusto allow changing initially focused buttoncountbuttonLabelOn,buttonLabelOffpropsinstant(default),medium,longsecondaryActions💥 Breaking Changes
We’ve removed our dependency on the end-of-life library styled-components. This means some component styling will need to change:
sxprop is no longer supported. You can style components by providing aclassNameand using CSS Modules.styled-systemare no longer available.Deprecated Components
The following components are now deprecated and will be removed in a future release:
@primer/react/deprecatedinstead of@primer/react.Removed Components
The following deprecated components have been removed from Primer React:
leadingVisualand an Avatar from @primer/react insteadRemoved Props
The following props are no longer supported:
overflowpropertyleadingIconin favor ofleadingVisualcontrastprop is no longer supportedChange to ESM Only
The
@primer/reactpackage now publishes only ESM (ECMAScript Modules) artifacts. This should have minimal impact, as modern versions of Node.js support require()'ing ESM modules.🛠️ Migration and Compatibility
If you are using components or utilities that rely on
styled-systemprops or theme being available via context, for example:Box,sxoruseTheme, you will need to update your codebase to remove these dependencies (prefer to use CSS modules overstyled-componentsand css variables over javascript theming) prior to adopting v38. If you’re looking to upgrade to v38 while still supportingstyled-components, drop us a comment below, we’d love to hear from you!If you’re using Primer theming, take a look at our Migrating to CSS variables compatibility guide.
See the full changelog for a detailed recount of every change included in v38. Let us know in a comment below if you run into any bugs, if a change to a component you were using is unclear, or if you have any other feedback about this release.
Beta Was this translation helpful? Give feedback.
All reactions