材质按钮更改禁用的按钮样式

时间:2019-11-12 09:53:13

标签: button material-ui

如何使用主题在Material-UI中更改禁用按钮的样式?

以下code不起作用

const theme = createMuiTheme({
  props: {
    // Name of the component 
    MuiButtonBase: {
      // The default props to change
      disableRipple: true // No more ripple, on the whole application !
    }
  },
  overrides: {
    MuiButton: {
      text: {
        color: "red"
      },
      disabled: {
        text: {
          color: "blue"
        }
      }
    }
  }
});

function DefaultProps() {
  return (
    <ThemeProvider theme={theme}>
      <Button disabled>Change default props</Button>
    </ThemeProvider>
  );
}

1 个答案:

答案 0 :(得分:1)

以下作品:

const theme = createMuiTheme({
  props: {
    // Name of the component 
    MuiButtonBase: {
      // The default props to change
      disableRipple: true // No more ripple, on the whole application !
    }
  },
  overrides: {
    MuiButton: {
      root: {
        color: "red",
        '&$disabled': {
           color: "blue"
       }
      },
    }
  }
});

Edit Invisible Backdrop