Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i change TextField underline hover color by theme palette?

Tags:

material-ui

material-ui v1

How can I change TextField underline hover color by theme palette? I know it possible by overrides, but how it can work for all components by standart palette options? like:

const themeMui = createMuiTheme({
  palette: {
    primary: lightBlue,
    secondary: blue,
    error: red,
    common: {
      darkBlack: blue.A700,
    }
  }
});

What exactly CSS code I want to change:

enter image description here

like image 573
artalar Avatar asked Sep 12 '17 09:09

artalar


People also ask

How to change textfield underline color in flutter?

With the help of Flutter Agency, you can understand step-by-step procedures and change the underline color. Here is the complete code for changing the Textfield underline color. First of all, import the material dart package into the application file. Next, call myapp class by implementing the void main runapp () method.

Do I need to change the border color of text fields?

Material-UI comes with a default theme implementation out of the box that you could leverage in your projects. They also have a great extensive documentation on how you create your own theme. So, if you have your theme set, you ideally do not need to customize the border color of a text field.

What is the color of the bottom underline of the textfield?

It comes up with a default light blue color bottom underline. If you have any doubts when changing the color, you can speak with an agency and get an idea. Textfield is an important element that allows users to input relevant details like name, password, address, and a lot more.

Why can't I see an orange border around the Textfield?

We see it applied in dev tools, yet we don’t see an orange border around the TextField. Unfortunately, targeting the root class applies the borderColor to an inner element of the TextField that doesn’t actually control the border color. So let’s try again via trial-and-error.


1 Answers

Hey I realize this is a bit old, but I have been having the same problem. I came up with this. Hope it helps... there docs are not the best on this!

const theme = createMuiTheme({
  overrides: {
    MuiInput: {
      underline: {
        color: 'red',
        '&:hover:not($disabled):after': {
          backgroundColor: 'red',
        },
        '&:hover:not($disabled):before': {
          backgroundColor: 'red',          // String should be terminated
        },
      },
    },
  },
});
like image 131
Djtouchette Avatar answered Oct 20 '22 14:10

Djtouchette