How to change MUI v6 DatePicker text field to standard variant

236 views Asked by At

My current code

 <DatePicker
              label="End Day"
              inputFormat="MM/DD/YYYY"
              value={activityEndTime}
              onChange={updateEndTime}
              sx={{
                width: "10rem",
              }}
            />

here is how it looks like

enter image description here

how i want it to look like (i just want an underline, not a full rectangle outline)

enter image description here

any help would be much appreciated

1

There are 1 answers

0
dkorsakas On BEST ANSWER

The desired result can achieved by adding a slotProps property:

<DatePicker
              label="End Day"
              inputFormat="MM/DD/YYYY"
              value={activityEndTime}
              onChange={updateEndTime}
              sx={{
                width: "10rem",
              }}
              slotProps={{ textField: { variant: "standard" } }}
 />