So I'm trying to configure a theme for Material-Ui on my React app. In the app I use two different type of buttons, contained and outlined. The problem is the hover effect on the contained button (the outlined works fine) and will default to a grey hover effect.
overrides: {
MuiButton: {
contained: {
backgroundColor: palette.primary.main,
color: palette.primary.contrastText,
"&:hover": {
backgroundColor: palette.primary.active,
},
},
outlined: {
color: palette.primary.main,
"&:hover": {
backgroundColor: palette.primary.active,
},
},
}
}
outlined = working
contained = not working
This is from the element inspector, where my color is the one with a strike through
background-color:
#e0e0e0.MuiButton-contained:hover
rgba(23, 0, 255, 0.3).MuiButton-contained:hover
Anyone got any idea what's wrong?
You can try adding root, so something like:
overrides: {
MuiButton: {
root: {
"&:hover": {
backgroundColor: palette.primary.active,
},
}
}
}
By default, the hover color (the background, for contained; the border, for outlined) will be palette.primary.dark. It could be these conflicting setup might cause some issues, try setting it there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With