ui-kit0.0

Forms

Date picker

Pick a date or a range from a field.

Usage

A field that looks like an input and opens the Calendar in a popover. Picking a day closes it. Inside a Field the label, hint and error wire themselves up. Here weekends and past days are blocked.

Payments run on weekdays only.

When to use

  • A single date in a form: due date, birthday, delivery day.
  • A start and end that belong together: a stay, a report period, a campaign — use DateRangePicker.
  • Dates people know by heart or paste from elsewhere — add typeable.

Not for: browsing a month with no field around it (use Calendar), or a date years away that is quicker to type (a birth year, say) — use typeable or a text input.

Typeable

With typeable the text can be edited. It is parsed on Enter and on blur: ISO dates, numbers in the locale’s day/month order, and month names all work. Something that is not a real date, or is outside min and max, marks the field invalid and keeps what was typed. ArrowDown opens the calendar.

Type a date (3/14/2027, Mar 14, 14 March 2027) or open the calendar. Press Enter to confirm.

Date range with presets

DateRangePicker shows two months side by side (one on phones) and a column of presets. The range commits when the second date is picked. Replace the presets with your own — each one is a label and a function of today — or pass presets={false} to hide them.

Pick your arrival and departure dates.

Apply and cancel

Add confirm for filters that reload data: the picker keeps a draft and only commits on Apply. Cancel, Esc and a click outside discard it. This one uses the default presets: Today, Yesterday, Last 7 days, Last 30 days, This month, Last month and This year.

Showing revenue for all time

In a form

Give the picker a name (or startName and endName for a range) and it submits ISO dates, yyyy-mm-dd, through hidden inputs — never a locale string.

API

DatePicker

PropTypeDefaultDescription
value / defaultValueDate | null—Selected day. Controlled or uncontrolled.
onValueChange(value: Date | null) => void—Called on pick, clear and typed commits.
open / defaultOpen / onOpenChangeboolean—Control the popover.
localestring'en-US'BCP 47 tag for the text, the calendar and typed input.
formatIntl.DateTimeFormatOptions{ month: "short", day: "numeric", year: "numeric" }How the value is shown.
placeholderstring'Pick a date'Shown while empty.
clearablebooleantrueClear button once there is a value.
typeablebooleanfalseEdit the date as text.
min / maxDate—Earliest and latest selectable day.
disabledDatesDate[] | (date: Date) => boolean—Days that cannot be picked or typed.
disabled / requiredboolean—Also follow the surrounding Field.
namestring—Hidden input name; submits yyyy-mm-dd.
size'sm' | 'md' | 'lg''md'Height: 32 / 36 / 44px.
calendarPropsPick<CalendarProps, …>—weekStartsOn, previousLabel, nextLabel, showOutsideDays.
...propsHTMLAttributes<HTMLDivElement>—Forwarded to the field; ref goes to it too.

DateRangePicker

PropTypeDefaultDescription
value / defaultValue{ from: Date | null; to: Date | null }—Selected range.
onValueChange(range: DateRange) => void—Called when a range is committed or cleared.
presetsDateRangePreset[] | falseToday … This yearShortcuts. Each is { label, range(today) }.
confirmbooleanfalseApply / Cancel footer; nothing commits before Apply.
startName / endNamestring—Hidden input names; submit yyyy-mm-dd.
placeholderstring'Pick a date range'Shown while empty.
...locale, format, min, max, disabledDates, disabled, required, size, today, clearable—As DatePicker.

Helpers: formatPickerDate, formatPickerDateRange, parsePickerDate and defaultDateRangePresets are exported for your own text and presets.

Keyboard

KeyAction
Enter / SpaceOn the field: open the calendar. In typeable mode, Enter commits the text.
Arrow DownOpen the calendar from the field.
Arrows, Home, End, Page Up / DownMove around the calendar (see Calendar).
Enter / SpaceOn a day: pick it.
EscClose without changing; focus returns to the field.
TabMoves through the panel; tabbing out closes it.

Accessibility

  • The trigger is a button with aria-haspopup="dialog" and aria-expanded; its value is announced as its description.
  • The panel is a non-modal dialog with a label; the calendar follows the APG date-grid pattern.
  • Typed text uses aria-invalid. Clear and calendar buttons have accessible names.
  • Keyboard focus shows a 3px ring on the whole field.

Motion

  • The panel rises in 4px from the field with a soft blur and leaves faster.
  • The field itself never scales: it opens a popup, so it answers with border and ring.
  • Reduced motion: the panel only fades.