[Theming] Allow component specific global theme overrides
See original GitHub issueThere seems to be a need to override global styles per component due to design language differences and variations. Per component global overrides should be on a theme or the ThemeProvider level.
Current Behavior
Currently, in order to override styles on a specific component across the whole application, you’d need to create and use a customized component that passes needed overrides to the BaseUI component.
Potential Solutions
- Let the
styled
function accept a third argument, that is a per component style override hook. A POC can be found here. Some cons here:- Component overrides would be css declaration blocks or functions that return a css declaration block in order to support dynamic styles. As opposed to the theme that contains style values only and no css declarations.
- Have optional component specific style values in the theme obj. POC.
Cons:
- The styled components code get’s messy
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (12 by maintainers)
Top Results From Across the Web
Global Styling with Material-UI Theme Overrides and Props
Learn how to use global CSS overrides and default props in a theme to customize all instances of a Material-UI component in a...
Read more >Material-UI Customization Part 2, Global Overrides for Theme
In this video, we go over how to override Material-UI component styling at a global level. The Material-UI documentation refers to the ...
Read more >Material UI in React #3 - Styles - adding global theme and ...
0:12 - Intro 0:12 ; 3:10 - Reusable button component 3:10 ; 4:39 - Overriding styles using SX props 4:39 ; 5:59 -...
Read more >Theming - Material UI - MUI
If you wish to customize the theme, you need to use the ThemeProvider component in order to inject a theme into your application....
Read more >Material-UI React: Global theme override for Paper component
You can also use your CssBaseline component if you're already using it for global reset...all depends ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Did you fine folks make any decisions around this? It would be super great to get for those of us who want to make themes that do fancier stuff!!
Sorry, my bad! I was just thinking about the concept while preparing this code snippet so I just took some parts of it from the official docs, forgot to replace the names! 😅 Just fixed it.
Then maybe I can create a PR with a better explanation of everything after running tests and making sure this works