Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the height of MUI Datepicker input box in MUI Material v6

<Paper elevation={0}>
  <DatePicker
    fullWidth
    views={['year', 'month', 'day']}
    openTo='month'
    value={initialDate}
    slotProps={{ textField: { sx: { height: '10px' } } }}
    onChange={(newValue) => handleInitialDateChange(newValue)}
  />
</Paper>

I have the above code. For some reason the height property I passed via sx via textField via slotProps is only affecting the Paper component.

Any help is appreciated.

like image 747
Dark Avatar asked Sep 12 '25 03:09

Dark


1 Answers

With your solution the placeholder is not well placed.

It's better to use this one:

<DatePicker
  slotProps={{ textField: { size: 'small' } }}
/>
like image 162
Simon Avatar answered Sep 13 '25 17:09

Simon