Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the height of MUI X Date Picker input box in React

<DesktopDatePicker
    label="Expiration Date"
    inputFormat="MM/dd/yyyy"
    value={self.didexpirationdate}
    onChange={(e)=>{
    setSelf({...self,didexpirationdate:e})
    }}
    renderInput={(params) => <TextField {...params} />}/>

How to set the height of this DatePicker in react?

like image 721
Rahat Khan Pathan Avatar asked Sep 05 '25 10:09

Rahat Khan Pathan


1 Answers

Date Component - V5

TextField component is used as input box so you can directly add the size there. please refer https://mui.com/components/text-fields/#sizes

...
renderInput={(params) => <TextField size="small" {...params} />}/>

Date Component - V6

in V6 version slotProps is introduced to customise the appearance of date component. please refer https://mui.com/x/react-date-pickers/custom-field/ for more details.

<DatePicker
  label="Small picker"
  slotProps={{ textField: { size: 'small' } }}
/>
like image 58
Prashant Jangam Avatar answered Sep 08 '25 02:09

Prashant Jangam