How can I change the underline color of a textfield inside a dialog with my secondary palette color? I couldn't do it since the documentation it's quite confusing
Assuming you are using material-ui-next, you can use overrides in createMuiTheme.
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
const theme = createMuiTheme({
overrides: {
MuiInput: {
underline: {
'&:before': { //underline color when textfield is inactive
backgroundColor: 'red',
},
'&:hover:not($disabled):before': { //underline color when hovered
backgroundColor: 'green',
},
}
}
}
});
Then wrap you app with MuiThemeProvider
ReactDOM.render(
<MuiThemeProvider theme={theme}>
<Root />
</MuiThemeProvider>,
document.getElementById('root')
);
It will overwrite underline color of all TextField material-ui components. If you need to change color only for one TextField, use https://material-ui-next.com/customization/overrides/#1-specific-variation-for-a-one-time-situation
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