How to localize MUI(v5) date picker input or set a placeholder

Viewed 6485
1 Answers

You have to change the placeholder of the textfield on renderInput without overwriting the data on params.inputsProps. This would be your new DesktopDatePicker.

<DesktopDatePicker
    label="Date desktop"
    inputFormat="dd/MM/yyyy"
    value={value}
    onChange={handleChange}
    renderInput={(params) => (
      <TextField
        {...params}
        inputProps={
          { 
            ...params.inputProps, 
            placeholder: "dd/mm/aaaa" 
          }
        }
      />
    )}
/>

This is the link for the fixed CodeSandBox example, the DatePicker component is on demo.js

Edit DesktopDatePicker

Related