Skip to content
Alea0.1

Forms

Dates and times

Type a date or pick it from a calendar, ranges, times, all in the person's locale and calendar.

Ant Design: DatePicker, RangePicker, TimePicker, Calendar

import { DatePicker, DateRangePicker, DateField, TimeField, Calendar, parseDate } from '@alea/ui';

Examples

DatePicker

Type it or pick it.

Launch date
When the plugin goes live

Range and limits

Weekends unavailable, nothing in the past.

Workshop days

DateField and TimeField

Segments people type into.

Birthday
mmddyyyy
Reminder
––––AM
24 hours
––––

Calendar

A calendar on its own.

Pick a day, October 2026

27
28
29
30
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

Date and time

granularity="minute" adds the time to the same field; hourCycle sets 12 or 24 hours.

Publish at

Props

DatePicker props

Type a date or pick it from a calendar (Ant's DatePicker).

PropTypeDefaultDescription
descriptionReactNode-Help text under the field.
errorMessageReactNode | ((v: ValidationResult) => ReactNode)-Error text, shown when invalid.
labelReactNode-The visible label.

DateRangePicker props

Type or pick a start and end date.

PropTypeDefaultDescription
descriptionReactNode-Help text under the field.
errorMessageReactNode | ((v: ValidationResult) => ReactNode)-Error text, shown when invalid.
labelReactNode-The visible label.

DateField props

Type a date segment by segment, in the person's locale format.

PropTypeDefaultDescription
descriptionReactNode-Help text under the field.
errorMessageReactNode | ((v: ValidationResult) => ReactNode)-Error text, shown when invalid.
labelReactNode-The visible label.

TimeField props

Type a time; 12 or 24 hours from the locale (hourCycle to force one).

PropTypeDefaultDescription
descriptionReactNode-Help text under the field.
errorMessageReactNode | ((v: ValidationResult) => ReactNode)-Error text, shown when invalid.
labelReactNode-The visible label.

Calendar props

A month to pick a date from. Arrow keys move by day, Page Up/Down by month.

PropTypeDefaultDescription
aria-labelstring-Defines a string value that labels the current element. (React Aria)
autoFocusboolean-Whether to automatically focus the calendar when it mounts. (React Aria)
childrenChildrenOrFunction<DisclosureGroupRenderProps>-The children of the component. A function may be provided to alter the children based on component state. (React Aria)
classNameClassNameOrFunction<CalendarRenderProps<"single">>-The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. (React Aria)
defaultValuestring[]-The default value (uncontrolled). (React Aria)
idstring-The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). (React Aria)
isDisabledboolean-Whether the calendar is disabled. (React Aria)
isInvalidboolean-Whether the current selection is invalid according to application logic. (React Aria)
isReadOnlyboolean-Whether the calendar value is immutable. (React Aria)
maxValueDateValue | null-The maximum allowed date that a user may select. (React Aria)
minValueDateValue | null-The minimum allowed date that a user may select. (React Aria)
onChange((value: string[]) => void)-Handler that is called when the value changes. (React Aria)
selectionMode"single"-Whether single or multiple selection is enabled. (React Aria)
styleStyleOrFunction<DisclosureGroupRenderProps>-The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. A function may be provided to compute the style based on component state. (React Aria)
valuestring[]-The current value (controlled). (React Aria)

RangeCalendar props

A month to pick a start and end date from.

PropTypeDefaultDescription
aria-labelstring-Defines a string value that labels the current element. (React Aria)
autoFocusboolean-Whether to automatically focus the calendar when it mounts. (React Aria)
childrenChildrenOrFunction<DisclosureGroupRenderProps>-The children of the component. A function may be provided to alter the children based on component state. (React Aria)
classNameClassNameOrFunction<CalendarRenderProps<"single">>-The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. (React Aria)
defaultValuestring[]-The default value (uncontrolled). (React Aria)
idstring-The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). (React Aria)
isDisabledboolean-Whether the calendar is disabled. (React Aria)
isInvalidboolean-Whether the current selection is invalid according to application logic. (React Aria)
isReadOnlyboolean-Whether the calendar value is immutable. (React Aria)
maxValueDateValue | null-The maximum allowed date that a user may select. (React Aria)
minValueDateValue | null-The minimum allowed date that a user may select. (React Aria)
onChange((value: string[]) => void)-Handler that is called when the value changes. (React Aria)
styleStyleOrFunction<DisclosureGroupRenderProps>-The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. A function may be provided to compute the style based on component state. (React Aria)
valuestring[]-The current value (controlled). (React Aria)

Accessibility

  • Each part of a date is its own spin button, so dates are typed, not guessed.
  • The calendar is a grid with day names; unavailable days are announced.

Keyboard

KeyDoes
Arrow Up / DownChange the focused part
TypingFills the part
Arrow keys (calendar)Move by day or week
Page Up / DownMove by month

Do and don't

Do

  • Use minValue, maxValue and isDateUnavailable for real limits.

Don't

  • Don't use a date picker for birthdays far in the past: DateField is quicker.
Tested with axe, keyboard and screen reader roles