Reputation: 1395
There is react + material-ui application and used Button component.
<Button classes={{root: classes.button, label: classes.label}} variant="raised" color="primary">
Which attribute do I need change for changing background color of button on click? By default it is yellow.
I got Button component from here https://material-ui-next.com/demos/buttons/
Upvotes: 0
Views: 12482
Reputation: 2149
secondary
color in the material-ui theme like:const muiTheme = createMuiTheme({ palette: { primary: lightBlue, secondary: pink, }, })
Add a method to your component to handle changing the value of the color
variable:
handleClick(e){ this.setState({ color: 'secondary' }) }
Add onClick
attribute to the button like
onClick={(event) => this.onClick(event)}
Upvotes: 2