Trying out MUI V5 and using theme to override component default styling.
But when I override like this:
components: {
MuiAppBar: {
styleOverrides: {
root: {
backgroundColor: theme.palette.primary.dark,
},
},
},
It works fine, and the appbar has the correct color I want by default.
However, when I want to change the color on the Appbar by doing:
<AppBar color='secondary'> It does not work since the theme style override is loaded last.
As you can see in image below, 'secondary' color is loaded first and therefor falls short of the theme override.
What am I doing wrong to actually prevent color property to work when overriding the default appbar color in the theme?
I have also tried this, which makes the color property work after theme has set color.
components: {
MuiAppBar: {
defaultProps: {
color: 'primary', //but i want primary.dark
},
},
},
But then I am limited to use 'primary' and cant use the theme.palette.primary.dark to get the color I want.
Codesandbox where the second appbar should be orange since it has color="secondary"
