Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove the underline of TextField from Material-UI? [duplicate]

I want the TextField to be naked(no underline) when using material-ui TextField. I do know that using InputBase from material-ui can achieve this, but I kinda need to use TextField API to achieve this but i did not find the way to do it in the API guide.

like image 332
H.Zhao Avatar asked Sep 12 '19 20:09

H.Zhao


People also ask

How do I remove the underline in material UI TextField?

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.

How do I remove an underline in typography?

The underline can be easily remove by using text-decoration property. The text-decoration property of CSS allows to decorate the text according to requirement. By setting the text-decoration to none to remove the underline from anchor tag.

How do I get rid of underline in Mui select?

Add the disableUnderline prop to Select . Here's a modified version of your sandbox: https://codesandbox.io/s/disable-underline-xulxq?file=/src/Dropdown.jsx.

How do I hide the label in TextField material UI?

You can prevent the label from "shrinking" up with InputLabelProps={{shrink: false}} . This works but produces another bug in which the label never leave and you end up writing the text over the label.


1 Answers

You can also use the InputProps prop on the TextField component to achieve this by setting the disableUnderline property to true.

<TextField   fullWidth   placeholder="Search..."   InputProps={{ disableUnderline: true }}  />
like image 143
Kofi Nartey Avatar answered Oct 03 '22 05:10

Kofi Nartey