【问题标题】:Material-Button changing disabled button styleMaterial-Button 更改禁用按钮样式
【发布时间】:2019-11-12 09:53:13
【问题描述】:

如何使用主题更改 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>
  );
}

【问题讨论】:

    标签: button material-ui


    【解决方案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"
           }
          },
        }
      }
    });
    

    【讨论】:

      猜你喜欢
      • 2016-07-13
      • 2015-10-04
      • 2020-08-15
      • 1970-01-01
      • 2014-12-08
      • 2016-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多