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:
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.
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.
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.
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.
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
},
},
},
},
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With