【问题标题】:How to create a customised Button using Material-UI?如何使用 Material-UI 创建自定义按钮?
【发布时间】:2019-10-02 20:49:58
【问题描述】:

Material-UI 允许您使用 withStyles() 创建具有一组样式的 Button,但我想知道是否可以使用 props 代替,所以所有我正在创建的自定义按钮将disableRipple 设置为false,而不必将道具添加到每个单独的按钮。

希望这是有道理的。

【问题讨论】:

标签: javascript reactjs material-ui


【解决方案1】:

看来您可以通过配置 globals 来做到这一点。

Example form docs:

const theme = createMuiTheme({
  props: {
    // Name of the component ⚛️
    MuiButtonBase: {
      // The default props to change
      disableRipple: true, // No more ripple, on the whole application ?!
    },
  },
});

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2020-12-03
  • 1970-01-01
  • 2021-05-19
  • 2019-09-19
  • 1970-01-01
  • 1970-01-01
  • 2022-08-15
  • 2019-04-24
相关资源
最近更新 更多