你能告诉我如何从输入字段中删除绿色反应吗?我知道它来自主题,我只是想从这个形式input
和select
字段中删除。
const theme = createMuiTheme({
palette: {
primary: green,
secondary: green
},
overrides: {
MuiInput: {
underline: {
color: "red",
"&:hover:not($disabled):after": {},
"&:hover:not($disabled):before": {}
}
}
}
});
我已经分叉了你的代码示例,并在主题覆盖中进行了编辑,以更改表单标签https://codesandbox.io/s/j3763x65y3的颜色。
在test.js
文件中,我编辑了以下内容:
在风格下:
noUnderline: {
color: "grey",
"&:after": {
borderColor: "grey",
color: "grey"
},
}
并作为相应TextField的属性:
<TextField
InputLabelProps={{
shrink: true,
focused: false
}}
InputProps={{
classes: {
focused: classes.noUnderline,
underline: classes.noUnderline
}
}}
</TextField>
我没有快速找到正确的类属性来改变InputLabel的聚焦颜色,所以我只是用focused: false
禁用焦点,虽然这不是一个非常优雅的解决方案,我不会在生产中使用它。
由于TextField组件是由其他组件组成的组件,因此请查看组件https://material-ui.com/api/text-field/的API文档以及组件的组件。