Skip to content

Date Time Picker

This component combines the date & time pickers.

It allows the user to select both date and time with the same control.

Note that this component is the NextDatePicker and NextTimePicker component combined, so any of these components' props can be passed to the DateTimePicker.

Basic usage

Allows choosing date then time. There are 4 steps available (year, date, hour, and minute), so tabs are required to visually distinguish date/time steps.

Press Enter to start editing

Uncontrolled vs. Controlled

The component can be uncontrolled or controlled

Press Enter to start editing

Responsiveness

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

  • The MobileNextDateTimePicker component works best for touch devices and small screens.
  • The DesktopNextDateTimePicker component works best for mouse devices and large screens.

By default, the NextDateTimePicker 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.

Press Enter to start editing

Static mode

It is also possible to render any date time picker without the modal/popover and text field. This will enable building custom popover/modal containers.

SMTWTFS
Press Enter to start editing

Form props

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

Press Enter to start editing

Validation

You can find the documentation in the Validation page

Customization

Here are some examples of heavily customized date & time pickers:

Hardcoded helper text

Press Enter to start editing

API

See the documentation below for a complete reference to all of the props and classes available to the components mentioned here.