2017-08-16 94 views
0

在一些material-ui组件中,我们有一个名为color的道具。我们可以通过'default', 'inherit', 'primary', 'accent', 'contrast'。但是我们可以传递一个自定义颜色吗?例如,我需要将按钮设置为红色。如果它不是我的主色或重音色,我该怎么做?如何将自定义颜色添加到material-ui组件中?

回答

0

你可以给按钮一个style={{backgroundColor: 'red'}},它会改变按钮的颜色。

<FlatButton label="My Colored Button" style={{backgroundColor: 'red'}} /> 
+0

是否可以给一个自定义的十六进制值? – THpubs

+0

@THpubs是的,就像我在答案中的例子一样。 'style = {{backgroundColor:'#FFF'}}' – CaseyC

相关问题