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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Container] - property disableGutters
doesn't work if theme styleOverrides
have been applied
#30825
Comments
As a workaround (must have components: {
MuiContainer: {
styleOverrides: {
root: ({ ownerState, theme }) => ({
...!ownerState.disableGutters && {
[theme.breakpoints.between('xs', 'sm')]: {
padding: '0 20px',
},
[theme.breakpoints.up('md')]: {
padding: '0 90px',
},
},
}),
},
},
}, https://codesandbox.io/s/simplecontainer-material-demo-forked-g9q93?file=/demo.tsx I mention this as a workaround because this makes customization very confusing. The real fix in my opinion is cc @oliviertassinari @mnajdova for more opinions. |
I am not sure that this is unexpected behavior to be honest. The override should win, that is why it is an override. It is your responsibility to make sure that if you add a override the other props combination still work as expected. I wouldn't be bumping t he specificity to be honest. It is similar to as if you change the color of a button in a style override. It would have that color even if the color prop is used, because that is the override you've added. You can use the props combination to specify when the style override should be applied. |
Interesting. Let's assume that anything specified in |
@RemyMachado is what's proposed in #30825 (comment) not working for you? Note that we are working on adding CSS variables for customization like this, that would allow us to specify these per component in the long term. Till then, I think what's proposed in the above comment is the best option. You could also add a CSS selector that would apply the styles if the class Does this makes sense? |
Duplicates
Latest version
Current behavior 馃槸
When the
Container
padding style is overridden, thedisableGutters
property stops working.Expected behavior 馃
The
disableGutters
property should work even with the style override.Steps to reproduce 馃暪
If the container style have been overridden, the
disableGutters
property won't work.The text was updated successfully, but these errors were encountered: