On this page
Overview
Show code, PublishDate.tsx
Calendar: the month the field opens.
Show code, PlanningCalendar.tsx
Variants
- A day
A day; choosing one closes the calendar. The default.
- A day and a time
A day and a time, with Now and the time's wheels.
Show code, Variants.tsx
In a toolbar
A field without a visible label, such as in a toolbar, shows its placeholder instead, and keeps enough width for a date.
Show code, SmallToolbar.tsx
Anatomy
Field
Control
Label
Value
Clear
Calendar icon
Description
Show code, DatePickerAnatomy.tsx
Popup
Previous month
Month
Next month
Day
Actions
Show code, DatePickerPopupAnatomy.tsx
Behaviour
States
A read-only field shows its value, and its calendar doesn't open.
A date and a time
With a time, the calendar stays open beside the time's wheels, and turning a wheel sets the time at once.
Show code, MeetingTime.tsx
Within a range
Days outside the allowed range are unavailable, and the month buttons stop at them.
Show code, WithinRange.tsx
Rules
Ask for a time only where it matters, and for a range in two fields.
Use it when
- A day, such as when a report goes out or a task is due
- A day and a time, such as when a meeting starts
- A day chosen from a month that stays in view, such as in a planning viewCalendar
Show code, DayOnly.tsx
Show code, NeedlessTime.tsx
Ranges
Use two fields for a range, such as First day and Last day.
Accessibility
| Key | Action |
|---|---|
| Enter, Space, ↓, ↑ on the field | Opens the calendar at the chosen day, or today. |
| ←, → | Moves a day, in the reading direction. |
| ↑, ↓ | Moves a week. |
| Page Up, Page Down | Moves a month; with Shift, a year. |
| Home, End | Moves to the start or end of the week. |
| Enter, Space on a day | Chooses the day. |
| ↑, ↓ on a time wheel | Chooses its previous or next value. |
| Esc | Closes the calendar and returns focus to the field. |
| Backspace, Delete on the field | Clears a clearable field. |