Skip to content

Time picker

Time pickers allow the user to select a single time.

The selected time is indicated by the filled circle at the end of the clock hand.

Basic usage

The time picker is rendered as a modal dialog on mobile, and a textbox with a popup on desktop.

<LocalizationProvider dateAdapter={AdapterDayjs}>
  <TimePicker
    label="Basic example"
    value={value}
    onChange={(newValue) => {
      setValue(newValue);
    }}
    renderInput={(params) => <TextField {...params} />}
  />
</LocalizationProvider>

Static mode

It's possible to render any time picker inline. This will enable building custom popover/modal containers.

Select time
:
123456789101112
<LocalizationProvider dateAdapter={AdapterDayjs}>
  <StaticTimePicker
    displayStaticWrapperAs="mobile"
    value={value}
    onChange={(newValue) => {
      setValue(newValue);
    }}
    renderInput={(params) => <TextField {...params} />}
  />
</LocalizationProvider>

Responsiveness

The time picker component is designed and optimized for the device it runs on.

  • The MobileTimePicker component works best for touch devices and small screens.
  • The DesktopTimePicker component works best for mouse devices and large screens.

By default, the TimePicker component renders the desktop version if the media query @media (pointer: fine) matches. This can be customized with the desktopModeMediaQuery prop.

There are certain caveats when testing pickers, please refer to this section for more information.

Form props

The time picker component can be disabled or read-only.

Validation

You can find the documentation in the Validation page

Landscape

Select time
:
051015202530354045505500
<LocalizationProvider dateAdapter={AdapterDayjs}>
  <StaticTimePicker
    ampm
    orientation="landscape"
    openTo="minutes"
    value={value}
    onChange={(newValue) => {
      setValue(newValue);
    }}
    renderInput={(params) => <TextField {...params} />}
  />
</LocalizationProvider>

Sub-components

Some lower-level sub-components (ClockPicker) are also exported.

001234567891011121314151617181920212223
<LocalizationProvider dateAdapter={AdapterDayjs}>
  <ClockPicker value={value} onChange={(newValue) => setValue(newValue)} />
</LocalizationProvider>

Seconds

The seconds input can be used for selection of a precise time point.