-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MuiThemeProvider as an override mechanism for a subtree #6129
Comments
Because we haven't implemented it. The @nathanmarks What do you think? |
We need to do here the same like styled-components do |
Wait, providing a new value on the context would not be an issue in my case. I just learned that the context is a new one for each subtree, so they don't collide when redefined. I thought its a collision because the inner provider overrides mui on the context for everything else, but its not! |
It turns out the issue is that once you try to override the same component using a provider, it still uses the same style tag and overwrites it completely. cc @nathanmarks |
Updated the example in main description. |
We should switch to https://github.com/iamstarkov/theming. It is a unifying theming solution for all styling libs and some of popular once already committed the migration (which is easy). |
@kof do you want to have a go at switching it in? |
I am not sure if I am able to actually do it, because of time but yeah, we should at least discuss and and agree on that. |
Theme nesting is fully supported now. It's all in the documentation. |
Except that overrides are extended which means I have to re-override in every sub tree. I want nested themes where I start completely fresh overrides with createMuiTheme(), is that possible? My goal is to use Portal for some printing stuff where I simply want plain light theme. |
@andrispraulitis Yes, it is. You are in control of how the outer (parent) theme impact the inner (child) theme. This example was made for you: https://material-ui.com/customization/themes/#nesting-the-theme. |
Yes I think I got it now. const defaultTheme = createMuiTheme()
const theme = outerTheme => defaultTheme |
@andrispraulitis It doesn't need to be a callback. It can be simple object. |
Given a case: I have 2 types of a Button, first one with rounded corners, second one without. Now in case I want all buttons inside of some subtree use the second type, I would want to use the MuiThemeProvider.
In this case, theme2 will overwrite theme1 style sheet.
The text was updated successfully, but these errors were encountered: