Skip to content

Date picker

A date field and calendar popover on react-aria-components. Adapted from BoardUI (MIT).

Dates go in and out as ISO strings such as 2026-03-12. A pick is staged until Apply. The Calendar it also exports is the bare month, which commits on every pick: use it where the picker already sits in a menu.

With a label

Empty

Earliest and latest

Required in a form

Ghost

Due
Paid

Disabled

Invalid

Calendar alone

Due date, March 2026

March 2026
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

Value: 2026-03-12

Installation

npx shadcn@latest add @khaeli/date-picker

Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.

Installs with

npm packages
  • @internationalized/date ^3.12.1
  • @keyline-icons/react ^2.2.0
  • motion ^12.23.12
  • react-aria-components ^1.17.0

Keyboard

EnterSpace
On the field, open the calendar: focus lands on the chosen day, or on today. On a day, stage it: the field keeps its date until Apply.
ArrowLeftArrowRightArrowUpArrowDown
Move focus by a day and by a week. Days outside min and max cannot be reached.
HomeEnd
Move focus to the first and to the last day of the month.
PageUpPageDown
Move focus to the same day in the month before and the month after.
Shift + PageUpShift + PageDown
Move focus to the same day in the year before and the year after.
Tab
Moves from the days to the date box, then to Clear, Cancel and Apply. Shift + Tab moves back to the month buttons.
Escape
Closes the calendar and drops a staged day. Focus returns to the field.

Accessible name

  • The field is a button with role="combobox": its date is read as its value. Pass id and point a @khaeli/label at it with htmlFor, or pass aria-label.
  • aria-label also names the popover's dialog and its calendar ("Due date, March 2026"). Named by a label alone, the dialog is called "Choose date" and the calendar "Date".
  • Each day is named in full, such as "Thursday, 12 March 2026 selected". The month buttons are Previous and Next, and the date box is "Date, DD/MM/YYYY": type a date there and press Enter to move the calendar to it.
  • aria-invalid and aria-describedby go to the field, so an error message is read as its description.
  • With name, the ISO date is submitted with the form. With required, the browser's own validation stops an empty submit.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/date-picker.json