我需要在Material-UI中更改禁用的TextField的字体颜色
我尝试了以下方法,但是它不起作用:
const useStyles = makeStyles(theme => ({
input: {
color: theme.palette.text.primary,
},
}));
function Example() {
const classes = useStyles();
return <TextField InputProps={{ className: classes.input }} />
}
答案 0 :(得分:1)
我能够弄清楚它是如何完成的:
const useStyles = makeStyles(theme => ({
disabledInput: {
color: theme.palette.text.primary,
},
}));
function Example() {
const classes = useStyles();
return <TextField
InputProps={{ classes: { disabled: classes.disabledInput } }}
/>
}