UI

Date

A unified date input supporting inline calendars, single-date popovers, and two-month range pickers with presets and comparisons.

import { DateInput } from '@uthereal/ui/date-input'

Date input playground

Pick the date for the review handoff.
Loading interactive preview…

Overview

DateInput unifies inline month calendars, single-date fields, and multi-month range pickers behind one schema and shared calendar core. Choose mode to mount the calendar inside a popover or directly on the page, and choose selectionMode for one date, a start-to-end range, or multiple dates. All modes store and emit ISO 8601 date strings (YYYY-MM-DD) owned by the host.

modeselectionModeDefault monthsDefault commitModeBest for
popoversingle1immediateForm fields such as due dates, deadlines, and birth dates.
popoverrange2 (1 below 712px)applyBookings, filters, and reporting windows with presets.
inlinesingle1immediateAlways-visible booking panels and dashboard date selectors.
inlinerange1 (or explicit 2)immediateEmbedded itinerary or reservation calendars inside a card.
inlinemultiple1 (or explicit 2)immediatePicking several non-contiguous dates with maxSelectedDates.

Use DateInput for calendar dates and date ranges. Enable allowTyping in popover mode when users type known dates from memory.

Usage

'use client'
import { useState } from 'react'
import { DateInput } from '@uthereal/ui/date-input'

export function LaunchDate() {
  const [dates, setDates] = useState<string[]>([])
  return (
    <DateInput
      label="Launch date"
      min="2026-01-01"
      value={dates}
      onValueChange={setDates}
    />
  )
}

value and onValueChange always use ISO date arrays ([date] for single, [start, end] for range, and a list for multiple). In range mode with compare, control the comparison rule independently with comparison and onComparisonChange, or compute the matching period on the server with comparisonRange.

Examples

Inline calendar

Set mode="inline" to render the calendar grid directly on the page without a trigger or popover. Use variant="ghost" for a bare grid inside a card, showToday for a header jump pill, or selectionMode="multiple" with disabledWeekdays and maxSelectedDates for availability pickers.

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
1
2
3
4
5
6
7
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
1
2
3
4
5
6
7

Range picker

Set selectionMode="range" and defaultPresets for a popover that shows two months beside a vertical preset rail at 712px or wider, and collapses to one month under a scrolling preset row on narrow viewports. Selections stay in a draft state until the user selects Apply; Cancel, Escape, or outside clicks discard the draft.

Start dateEnd date

Reporting comparison

Combine selectionMode="range", compare, and an explicit today reference date for deterministic reporting windows. Setting today seeds standard reporting presets, bounds the range end when max is omitted, and renders comparison bands for previous-period (equal inclusive day count) or previous-year (leap-day clamped).

vs. Aug 23 – Sep 21, 2026

API reference

These serializable arguments and defaults come directly from the component schema.

ArgumentType / defaultDescription
labelstringDefault: "Date"Visible label and accessible name. Name the information asked for, in sentence case.
hideLabelbooleanDefault: falseHide the label visually when the context already names the field. It is still announced.
descriptionstring—Supporting text below the field, announced with it. Use it for format hints and constraints.
errorstring—Validation message from your application. Setting it marks the field invalid; the message is linked to the field and announced politely.
requiredbooleanDefault: falseMarks the field as required for assistive technology and shows an indicator. Your application validates the value.
readOnlybooleanDefault: falseThe value can be focused, selected, and copied, but not edited. It is still submitted with a form.
disabledbooleanDefault: falseUnavailable and removed from the tab order. A disabled field is not submitted with a form.
namestring—Native form field name, submitted with the value in a form.
modepopover | inlineDefault: "popover"popover renders a trigger field that opens a calendar panel; inline renders the calendar grid directly on the page.
selectionModesingle | range | multipleDefault: "single"single picks one date; range picks a start and end date with stretching week highlights; multiple toggles separate dates (inline mode only).
months'auto' | 1 | 2Default: "auto"Number of visible months: auto renders 2 months beside a vertical preset rail in wide range popovers (>= 712px) and 1 month otherwise.
commitModeimmediate | apply—immediate commits on day selection; apply stages a draft with Cancel and Apply actions. Omitted defaults to apply in popover range mode and immediate otherwise.
defaultValuestring | string[]—Initial ISO date ("2026-10-17"), [start, end] tuple for range, or list of dates for multiple. Later edits do not reset a mounted instance.
maxSelectedDatesinteger—Maximum selectable dates when selectionMode is multiple; omitted allows any number up to 366.
todaystring—Host reference ISO date for deterministic reporting presets and default range bounds.
minstring—Earliest selectable ISO date. Earlier days are disabled in the calendar.
maxstring—Latest selectable ISO date. Later days are disabled in the calendar.
localestring—BCP 47 locale for date order, month/weekday names, and first weekday. Omit to inherit UtherealProvider locale or en-US.
startOfWeekinteger—First weekday column: 0 Sunday through 6 Saturday. Omit to follow locale.
disabledDatesstring[]Default: []Unavailable ISO dates (e.g. holidays), displayed struck through and skipped by selection.
disabledWeekdaysnumber[]Default: []Unavailable weekdays, 0 Sunday through 6 Saturday (e.g. [0, 6] for weekends).
presetsDatePreset[]Default: []Shortcuts beside the calendar. Each value matches the mode shape using fixed ISO dates or relative objects ({ unit, offset, edge }).
defaultPresetsbooleanDefault: falsePopulate standard relative presets (Today, Yesterday, Last 7/30/90 days, This/Last month, This quarter, Year to date) in range mode when presets is empty.
comparebooleanDefault: falseOffer previous-period and previous-year comparison options in range mode.
defaultComparisonoff | previous-period | previous-yearDefault: "off"Initial comparison rule in range mode; existing host state survives edits.
allowTypingbooleanDefault: falsePopover mode only: render locale-formatted date input(s) alongside a calendar trigger button instead of a single button trigger.
showTodaybooleanDefault: falseShow a Today button in the calendar header that jumps to the current month.
defaultOpenbooleanDefault: falseInitial popover visibility in popover mode; use open and onOpenChange for controlled state.
placeholderstringDefault: "Select a date"Shown in the trigger button or empty input when no date is selected.
placementPlacementDefault: "bottom-start"Preferred popover side and alignment; flips automatically to stay within the viewport.
variantoutline | soft | ghostDefault: "outline"Field surface in popover mode (outline, soft, ghost), or panel framing in inline mode (outline bordered, soft filled, ghost bare).
sizesm | md | lgDefault: "md"Field height and text scale: 36, 44, or 50 pixels.
labelsDateInputLabels—Translatable text and accessible names for navigation, presets, footer status, Apply/Cancel, and comparison options.
recipestudio | softDefault: "studio"Visual treatment. Both recipes preserve identical interaction behavior.
themeDateInputTheme—Color mode, accent, and semantic design tokens. See Theming for all keys and defaults.
motionnone | subtle | expressiveDefault: "subtle"Animation preset for popover entrance, rolling date text, sliding months, and stretching range highlights. none and system reduced motion disable travel.
motionOptionsDateInputMotionOptions—Calendar popup transition, entrance, and exit overrides (durations in milliseconds).
dirltr | rtl—Reading direction. Omit to inherit page direction.

React integration

PropPurpose
value, onValueChangeControlled ISO date array and commit callback (string[]).
comparison, onComparisonChangeControlled reporting comparison rule ('off' | 'previous-period' | 'previous-year').
open, onOpenChangeControlled popover visibility (mode="popover").
boundaryFunction returning a bounding element for responsive 1- vs 2-month measurement.
renderIcon(name, context)Custom icon renderer; slot is 'trigger', 'previous', 'next', or 'preset'.
portalContainerCustom portal target, e.g. an element inside a native modal dialog top layer.
refTrigger button, first typed input (allowTyping), or inline calendar root.
presetApplication defaults (locale, labels, startOfWeek), overridden by props.
tokensCSS custom properties applied after the typed theme on root and portal.
className, styleApplied to the root field element.
Native attributesForwarded to the trigger, first typed input, or inline container.

Keyboard & accessibility

KeyInteraction
TabMoves through the trigger (or inputs), preset rail, header controls, grid, footer.
Enter, Space, ArrowDownOn the closed trigger: opens the calendar popover.
Arrow keysMoves day by day or week by week across months; follows dir.
Home, EndMoves to the start or end of the current week.
PageUp, PageDownMoves by one month (Shift + PageUp/PageDown moves by one year).
Enter, SpaceSelects the focused day, preset, month, year, or comparison option.
ArrowUp/Down or Left/RightCycles focus inside the preset rail and comparison role="radiogroup".
EscapeCloses the popover, discards any staged draft, and returns focus to the trigger.

The trigger exposes aria-haspopup="dialog", aria-expanded, and a combined accessible name from the label and formatted value (or placeholder). The popover renders role="dialog" with a polite role="status" live region announcing range progress and visible months. Every calendar grid exposes role="grid", aria-selected, aria-current="date", and aria-disabled on unavailable or out-of-bounds days so keyboard navigation stays continuous. All layouts mirror in dir="rtl" and preserve borders, active ranges, and focus outlines in forced-colors: active.

Motion and theming

  • Popover entrance: grows 8px from the calendar icon at scale 0.95 on the snappy spring and exits in 140ms.
  • Rolling date text: changed date parts roll up for later dates and down for earlier dates while unchanged parts shift smoothly with layout="position".
  • Single and multiple grids: months slide on a retargetable zero-bounce strip and the single-date selection disc glides across cells.
  • Range grids: per-week highlight bars stretch along the logical inline axis (0.42s, bounce 0), start and end caps glide between days, and keyboard navigation snaps highlights immediately without lag.
  • Preset and comparison highlights: active pills glide on a critically damped spring (0.42s, bounce 0).
  • Reduced motion: prefers-reduced-motion: reduce replaces travel and springs with 120ms opacity crossfades; motion="none" makes all updates immediate (0ms).

theme accepts the core and control token groups, plus borderStrong, borderSubtle, surfaceSunken, accentStrong, accentSubtle, radiusSm, popupRadius, popupPadding, surfaceRadius, shadowResting, and the component token padding (--ui-date-input-padding).

Composition

DateInput is a leaf component. Its ISO date array is host state at /fields/instance-<id>/value, and its comparison rule is host state at /fields/instance-<id>/comparison. Stored values survive configuration edits while they remain valid for the active selectionMode, min, max, and maxSelectedDates.

{
  "type": "DateInput",
  "props": {
    "label": "Reporting period",
    "selectionMode": "range",
    "today": "2026-10-21",
    "defaultPresets": true,
    "compare": true,
    "defaultComparison": "previous-period"
  },
  "children": []
}

On this page