React Material UI: How to give a button a custom color when disabled?
Or you can try createMuiTheme
and customize the following property:
import { createMuiTheme } from '@material-ui/core/styles'
const theme = createMuiTheme({
palette: {
action: {
disabledBackground: 'set color of background here',
disabled: 'set color of text here'
}
}
}
You can define a class to be applied for disabled buttons:
const styles = theme => ({
disabledButton: {
backgroundColor: theme.palette.primary || 'red'
}
});
And then, use it like this:
<Button
variant="contained"
color="secondary"
disabled
classes={{ disabled: classes.disabledButton }}
>
Disabled
</Button>
You can find in the documentation all the classes that you can override.