Skip to content

Date picker

Pick a single date or a range on a month grid or by typing, docked below a field or in a dialog.

import { DatePicker, DateRangePicker, DateField } from '@windmorph/react';

Purpose

Date pickers let someone choose a date, or a range of dates. M3 has three variants: the docked date picker (DateField), a date field with a calendar just below it on medium and larger windows (on compact ones it opens the modal picker full screen); the modal date picker (DatePicker or DateRangePicker in a PickerDialog), full screen on compact windows; and the modal date input, the modal picker's typed mode behind its edit button.

Values are @internationalized/date CalendarDates (a { start, end } pair for a range). Each is controlled (value / onChange) or uncontrolled (defaultValue), and words are localised through the labels prop. For a date far in the past or future, such as a date of birth, prefer the docked picker or the typed input to paging the calendar. The typed input is titled "Enter date" ("Enter dates" for a range), as the M3 modal date input is; labels.inputTitle words it for the task.

When not to use

For a date far in the past or future, such as a date of birth, use the docked DateField or the typed input rather than the calendar.

See also

  • Date picker on m3.material.io: Material's own guidelines, with anatomy and specs.
  • Time picker: Pick an hour and minute on a clock dial or by typing, 12- or 24-hour.
  • Picker dialog: The modal form of a date or time picker, with confirm, dismiss and mode-toggle slots.
  • Text field: Filled or outlined text input with a floating label, icons, affixes, counter, error icon and a text area.