Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Error color and underline color on input focus using material-ui v1.0.0-beta.40

I am using Material-UI v1.0.0-beta.40 and I want to change the border color and error text color.

How can this be done?

like image 855
Anil Avatar asked Oct 12 '25 00:10

Anil


1 Answers

One of the ways to do it is inside of MuiTheme

import { createMuiTheme } from 'material-ui/styles';
const myTheme = createMuiTheme({
    overrides:{
        MuiInput: {
            underline: {
                    '&:after': {
                      backgroundColor: 'any_color_hex',
                    }
              },
        },
    }
});
export default myTheme;

and then import it into your component and use:

import {MuiThemeProvider} from 'material-ui/styles';
import myTheme from './components/myTheme'

<MuiThemeProvider theme = {myTheme}>
<TextField />
</MuiThemeProvider>

Hope this helps!

like image 157
Max Avatar answered Oct 14 '25 16:10

Max



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!