how to remove green color from input field in react?
how to remove green color from input field in react?
Could you please tell me how to remove green color from input field in react? I know it is coming from the theme, I just want to remove from only for this form input
and select
field.
input
select
Codesandbox
const theme = createMuiTheme(
palette:
primary: green,
secondary: green
,
overrides:
MuiInput:
underline:
color: "red",
"&:hover:not($disabled):after": ,
"&:hover:not($disabled):before":
);
can you please change my sandbox link
– user944513
Sep 5 '18 at 1:17
any update ? can you help me
– user944513
Sep 5 '18 at 1:34
I don't know how to do that offhand as I'm not familiar with the library. I gave you the link for direction. Sorry I couldn't be more helpful.
– Yatrix
Sep 5 '18 at 1:43
ok..thanks for help
– user944513
Sep 5 '18 at 1:43
1 Answer
1
I have forked your code example and edited in the theme overrides to change the color of the form label https://codesandbox.io/s/j3763x65y3.
In the test.js
file, i have edited in the following:
test.js
under styles:
noUnderline:
color: "grey",
"&:after":
borderColor: "grey",
color: "grey"
,
and as properties for the respective TextField:
<TextField
InputLabelProps=
shrink: true,
focused: false
InputProps=
classes:
focused: classes.noUnderline,
underline: classes.noUnderline
</TextField>
I did not quickly find the right classes property to change the focused color of the InputLabel, so I just disabled the focus with focused: false
, although this is not a very elegant solution and I would not use it in production.
focused: false
Since the TextField component is a component composed from other components, check out the API docs for the component https://material-ui.com/api/text-field/ as well as for the components it is composed of.
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
material-ui.com/api/input-label you have to override the styles.
– Yatrix
Sep 5 '18 at 1:13