Allow function for theme.overrides
See original GitHub issueIt will be fine to have theme properties available when overriding component style.
Example of usage:
const theme = createMuiTheme({
overrides: {
MuiButton: theme => ({
root: { backgroundColor: theme.palette.secondary }
})
}
})
May I create PR? Solution is to add
if (typeof overrides == 'function') overrides = overrides(theme)
after line 14 in styles/getStylesCreator.js
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
A Guide to Overriding Parent Theme Functions in Your Child ...
In this tutorial, I'll show you three methods you can use to override functions from the parent theme in your child theme:.
Read more >Allow function for theme.overrides · Issue #9443 · mui/material-ui
It will be fine to have theme properties available when overriding component style. Example of usage: const theme = createMuiTheme({ overrides: ...
Read more >how to override parent theme's function ? | Drupal.org
I'm making a subtheme and I need to replace a function of the parent theme (defined in .theme file) by my own. How...
Read more >How to override parent theme functions in a child theme
Taking advantage of pluggable functions – an easy way for overriding parent theme functions but only possible if your parent theme is making...
Read more >How to override parent theme functions in WordPress
When writing a parent theme, it's good practice to make your functions pluggable so that you can easily override them in child themes....
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 FreeTop 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
Top GitHub Comments
Let me know when you have something compatible with react-native. I’m eager to know more about it 😃.
@ndeviant I don’t get the problem. You can create a function to abstract the duplication/ternary operators.
It resonates a bit with option 2 in https://github.com/mui-org/material-ui/issues/26813#issuecomment-864615252 where the theme is also available as part of the props.