Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I change the border radius of a TextField in Material-UI React?

Im trying to customize the border radius of a TextField in MUI, but nothing is working. This is how it looks:
enter image description here

It comes with a borderRadius of 4px and Im trying to change it to 0px.

This is how my code Looks:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<TextField  
    id="time"
    type="time"
    inputProps={{
    step: 300, // 5 min
    style: {
      width: "225px",
      border: "1px solid #EAEAEA",
      borderRadius: "0",
      padding: "8px 0 8px 8px",
      fontFamily: "Roboto",
      fontSize: "14px",
    },
  }
}
        />

The rest of the styles are working. But for some reason, borderRadius is not.

I have also tried the sx property and style property, but neither is working.

>Solution :

Use InputProps, not inputProps (see the API reference)

InputProps={{ sx: { borderRadius: 0 } }}

https://codesandbox.io/s/compassionate-mahavira-s30k13?file=/demo.tsx

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading