My material UI custom classes are being overridden by material UI's default classes

Viewed 263

I have a TextField whose label I want to be colored as black when it is focused. I added the classes to InputProps with that classes variable but unfortunately, it is being overridden by material UI's default styling in chrome dev tools. Here is the code. Please check the screenshot of chrome dev tools.

const useStyles = makeStyles((theme) => ({
inputLabelFocused: {
color: "black",
 },
}));

const classes = useStyles();

<TextField
      id="toDo"
      label="To Do"
      multiline
      rows={4}
      variant="filled"
      fullWidth
      InputLabelProps={{
        classes: {
          focused: classes.inputLabelFocused,
        },
      }}
    />

image of custom classes being overridden by default material UI classes in chrome dev tools

1 Answers
const useStyles = makeStyles({
  inputLabelFocused: {
    color: "black !important",
  },
});
Related