Date / Time pickers
Date pickers and Time pickers provide a simple way to select a single value from a pre-determined set.
- On mobile, pickers are best suited for display in confirmation dialog.
- For inline display, such as on a form, consider using compact controls such as segmented dropdown buttons.
@mui/x-date-pickers
@mui/x-date-pickers provides date picker and time picker controls.
Native pickers
⚠️ Native input controls support by browsers isn't perfect. Have a look at @mui/x-date-pickers for a richer solution.
Datepickers
A native datepicker example with type="date"
.
<form className={classes.container} noValidate>
<TextField
id="date"
label="Birthday"
type="date"
defaultValue="2017-05-24"
className={classes.textField}
InputLabelProps={{
shrink: true,
}}
/>
</form>
<form className={classes.container} noValidate>
<TextField
id="datetime-local"
label="Next appointment"
type="datetime-local"
defaultValue="2017-05-24T10:30"
className={classes.textField}
InputLabelProps={{
shrink: true,
}}
/>
</form>
<form className={classes.container} noValidate>
<TextField
id="time"
label="Alarm clock"
type="time"
defaultValue="07:30"
className={classes.textField}
InputLabelProps={{
shrink: true,
}}
inputProps={{
step: 300, // 5 min
}}
/>
</form>