I want to remove the underline style and change the of the color of it when the text field gets focus in the autocomplete component of react material ui.
I can't seem to find the style to override.
Thanks in advance.
To remove underline from input component with React Material UI, we can set the disableUnderline prop to true . to add the disableUnderline to the Input component. As a result, we wouldn't see the underline of the input now.
clearOnBlur={true} helps to clear the value of the autocomplete component when it loses focus.
Minor update to @Liem's response. Just putting the InputProps
directly overwrites the InputProps
it would use by default, which breaks the component. By merging the disableUnderline
with the other InputProps
, it should work.
<Autocomplete
renderInput={
params =>
<TextField
{...params}
InputProps={{...params.InputProps, disableUnderline: true}}
/>
}
/>
Just adding another answer for material v1. In v1 we have to target the input inside the text field. in order to remove or style the underline
<TextField
defaultValue="hello"
InputProps={{
disableUnderline: true
}}
/>
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