Comments (4)
can you please explain more ?
from material-ui.
Sure, we have a MUI v4 theme where we have overrides setup which looks like this:
const theme = createTheme({
overrides: {
MuiButton: {
contained: {
backgroundColor: "grey",
},
},
},
});
Now, if we have a button here which doesn't have a color
defined f.e. <Button variant="contained">Grey</Button>
, this button will have the backgroundColor
from the overrides which is fine. But if a color="primary"
is added to the same button, it will no longer have the backgroundColor
from overrides but the actual primary
color. This is the expected behaviour.
This behaviour is explained in this codesandbox which uses MUI v4.
Now, we're trying to upgrade to v5. In MUI v5, after following the docs and everything, I updated my config for the overrides as per the migration guides and overrides look like this:
const theme = createTheme({
components: {
MuiButton: {
styleOverrides: {
contained: {
backgroundColor: "grey",
},
},
},
},
});
But after making this change and upgrading to v5, the behaviour is no longer the same as described above. Now, the overrides are being applied to both buttons regardless of color="primary"
defined or not which is not desirable. This behaviour can be seen in this codesandbox with MUI v5.
from material-ui.
The answer was posted on StackOverflow: https://stackoverflow.com/a/78167813.
from material-ui.
👋 Thanks for using our open-source projects!
We use GitHub issues exclusively as a bug and feature requests tracker, however,
this issue appears to be a support request.
For support with Material UI please check out https://mui.com/material-ui/getting-started/support/. Thanks!
If you have a question on Stack Overflow, you are welcome to link to it here, it might help others.
If your issue is subsequently confirmed as a bug, and the report follows the issue template, it can be reopened.
from material-ui.
Related Issues (20)
- [docs-infra] Multi-tab demo component improvements
- [material-ui][Autocomplete] Formik Form with multiple fields triggering all fields to be opened HOT 3
- [joy-ui][Theme] Components use radius 'sm' irrespective of their own size.
- [JOY with material-ui]
- [material-ui][Typography] Trouble adding new boolean props HOT 2
- Unable to target `MuiTooltip-tooltip` class
- [material-ui][Slider] TypeError: color.charAt is not a function error message after upgrade @mui/material to 5.15.14 HOT 1
- [pigment-css] Invalid CSS output w/ pseudo classes in theme.vars HOT 4
- [TextField] Add an isValid state to correspond to the error state. HOT 1
- [pigment-css] theme does not contain other properties except `vars` HOT 3
- [material-ui][Autocomplete] Adding start adornment on small autocompletes causes text to wrap HOT 2
- [material-ui][Switch] "Unsupported `76, 78, 100` color" error HOT 3
- Material UI components designs for Corel Vector HOT 1
- [material-ui][List] The ListItemButton component remains in the selected state even after being clicked HOT 6
- [pigment-css][vite] missing common `babel` plugin(s) & extremely slow
- [material-ui] Component import suggestion not appearing in VS Code HOT 8
- Huge gap in the line number section of the editor when on full screen. HOT 4
- [material-ui][Switch] focusElementRef is always undefined, disabling me to imperatively set focus HOT 1
- [material-ui][Menu] Error when running Jest Unit Tests: The `anchorEl` prop provided to the component is invalid. HOT 3
- [material-ui] TypeError: theme.typography.pxToRem is not a function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from material-ui.