ShocKwav3_
ShocKwav3_

Reputation: 1760

Change color of label in material-ui

I am trying change color of the subheader component. It only changes if i write like this

<subheader style={color.disabled} >Middle Name : </subheader>

where

const color = {
   disabled: {
    color: grey500,
  },
};

I am trying to change the subheader color when changing state. How can i do that?

Upvotes: 0

Views: 959

Answers (1)

Matt
Matt

Reputation: 3780

Unless I'm misunderstanding the question, there doesn't seem to be any more to this than standard use of state:

changeSubheader() {
  this.setState(
    subheaderDisabledColor: {
      disabled: {
        color: red500,
      },
    };
  );
};

<subheader style={this.state.subheaderDisabledColor}>Middle Name : </subheader>

https://facebook.github.io/react/docs/state-and-lifecycle.html#using-state-correctly

Upvotes: 1

Related Questions