React Material UI: How to give a button a custom color when disabled?

前端 未结 3 2139
面向向阳花
面向向阳花 2021-02-14 11:23

I\'m building a React App using Material UI.

If the button is disabled, it is grey and opaque. I\'d like it to be in my themes primary color and opaque.

So here

3条回答
  •  花落未央
    2021-02-14 11:44

    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:

    
    

    You can find in the documentation all the classes that you can override.

提交回复
热议问题