How to change Material UI input underline colour?

后端 未结 2 396
感动是毒
感动是毒 2020-12-17 15:12

I have a Material UI Select component that is on a dark background, so for just this one component I\'d like to change it so that the text and line colours are

2条回答
  •  自闭症患者
    2020-12-17 15:50

    If the goal is simply to turn the underline (and text as well), there's a very simple solution, which also works with many other components (, , etc.):

    const theme = createMuiTheme({
        palette: {
          type: 'dark',
        },
      });
    

    It will catch the underline and turn it white.

    For details on what this will change, in case you want to override elements of it: https://material-ui.com/customization/palette/#dark-mode

    (If you've never used a theme before, you'll need to import createMuiTheme and wrap your component in it; see https://material-ui.com/customization/theming/)

提交回复
热议问题