[material-ui] Add PropsProvider
for Pigment CSS integration
#42635
Labels
Milestone
PropsProvider
for Pigment CSS integration
#42635
Context
The current approach for customizing Material UI component's default props is using the
theme.components.*.defaultProps
through React context.For Pigment CSS, it's not possible to use React Component inside the theme because of build-time extraction.
Solution
Extract the defaultProps to another context,
PropsProvider
, so that users can customize the default props of Material UI components with Pigment CSS.How's it look like
Before or After migration to v6: no changes required, the
defaultProps
that pass to the theme will propagate toPropsProvider
automatically.Transitioned to Pigment CSS while having Emotion: no changes required as well, as long as the
ThemeProvider
is used on the client.Pigment CSS without Emotion: users need to import
PropsProvider
from Pigment CSS and pass thetheme.components
Finally, Emotion can be removed.
Search keywords:
The text was updated successfully, but these errors were encountered: