在DatePicker Material-UI的hintText上应用CSS

时间:2017-08-06 13:46:40

标签: reactjs material-ui

我正在使用Material-ui建立预订系统。在我的DatePicker中,我的hintText是白色的,几乎看不见,我想将颜色变为黑色。我使用了代码的示例 https://github.com/callemall/material-ui/issues/3753https://github.com/callemall/material-ui/issues/5737

我也尝试过Material-ui网站上的例子,但是这两个都没有用。我没有得到任何错误,它不仅仅是工作。有人知道我能做什么吗?

<div className="center-container">
    <DatePicker inputStyle={{color: 'black'}} hintText="Date..."                 
                           mode="landscape" minDate={new Date()}/>
</div>

1 个答案:

答案 0 :(得分:2)

有一个属性hintStyle,我们可以使用它来设置hintText的样式。

像这样:

<DatePicker
    autoOk={false} 
    mode="landscape"
    hintText='please'
    hintStyle={{color:'red'}}
/>

检查 working fiddle