DatePicker

DatePicker composes Calendar and an anchored overlay into one localizable, form-backed single-date control.

Overview and decision boundary

Use DatePicker for one custom, localizable ISO calendar date when native Input type=date is not sufficient.

Do not add ranges, presets, localized parsing, time, timezone conversion, scheduling, availability, recurrence, or product shortcuts.

Change date

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm exec nerio add date-pickerimport { Field } from "@nerio-ui/ui";import { DatePicker } from "@nerio-ui/ui/client";

Usage

import { Field } from "@nerio-ui/ui";import { DatePicker } from "@nerio-ui/ui/client";<Field label="Release date">  <DatePicker defaultValue="2026-06-15" clearable /></Field>

Variants

ContractDescription
UncontrolledUse defaultValue for a complete source-owned form control.
ControlledOwn value and open state when product composition requires it.
ClearableOpt into one explicit clear action; no presets or shortcuts are added.

Anatomy

SlotDescription
rootState wrapper for the trigger, popup, and form mirror.
triggerNative button aligned with the form-control family.
contentAnchored Base UI Popover surface.
Calendar slotsCalendar retains its complete public anatomy inside the popup.
clearOptional explicit action that returns the value to empty.
form-controlSingle hidden native form value mirror.

States

StateBehavior
EmptyShows the explicit placeholder and open action context.
SelectedFormats one ISO value for display without changing its submitted value.
OpenMoves focus into Calendar and restores it after selection or dismissal.
InvalidUses the form-family invalid border and forwards aria-invalid.
RequiredThe native form mirror participates in constraint validation.
Read-onlyThe popup remains inspectable while value and clear actions are locked.
DisabledThe trigger and form value are disabled.

Motion

  • Popover uses the shared overlay enter and exit contract.
  • Reduced motion keeps dismissal and focus behavior immediate.

Accessibility

  • Name the trigger through Field, Label, aria-label, or aria-labelledby.
  • A self-named trigger does not repeat its visible value; controls named by Field or explicit ARIA retain the localized selected value once before the open/change action.
  • Opening moves focus to Calendar's selected or active roving day; selection, Escape, outside dismissal, and clear restore focus to the trigger.
  • The public value and single named form mirror use the timezone-independent YYYY-MM-DD CalendarDate contract; null is the explicit controlled empty value.
  • Required, disabled, read-only, invalid, form ownership, submission, and reset behavior remain truthful.
  • Locale and formatValue change display only; DatePicker does not parse localized or natural-language text.
  • Calendar preserves its complete keyboard, RTL, constraint, forced-colors, reduced-motion, and localization contract.
  • Ranges, presets, time, timezone conversion, availability, scheduling, recurrence, and product shortcuts remain outside DatePicker.

Review the shared responsibility and evidence boundaries in the Accessibility foundation alongside this component-specific contract. Use the Spacing & layout foundation for shared density, wrapping, overflow, reflow, and component-versus-product ownership guidance. The Color foundation, Typography foundation, and Localization foundation define the shared visual-role, text-resilience, direction, and locale boundaries used by component examples.

API

PropTypeDescription
value / defaultValueCalendarDate | nullControlled or uncontrolled selected YYYY-MM-DD date; null is empty.
onValueChange(date | null) => voidReceives selection or an explicit clear.
open / defaultOpenbooleanControlled or uncontrolled Popover state.
onOpenChange(open, details) => voidReceives bounded Nerio dismissal details.
name / formstringNative form ownership and submitted key.
onInvalidFormEventHandler<HTMLInputElement>Observes native constraint validation.
required / disabled / readOnly / invalidbooleanForm and interaction states.
min / max / isDateDisabledCalendar contractReused Calendar constraints.
todayCalendarDateConsumer-owned current date for today styling and empty-state month selection.
locale / firstDayOfWeekIntl locale / 0–6Display, labels, and week order; locale defaults to en-US for deterministic SSR.
formatValue(date, locale) => ReactNodeStrict display formatting only; never parsing.
placeholderReactNodeExplicit empty-state text.
labelsDatePickerLabelsLocalized trigger context, clear, Calendar, and navigation copy.
clearablebooleanAdds one explicit clear action when a value exists.
refHTMLElementAccesses the public trigger control.

Implementation contract

ContractValue
Entrypoint@nerio-ui/ui/client
ValueTimezone-independent ISO YYYY-MM-DD or null.
OverlayBase UI Popover with Calendar as the single interactive date surface.
FormOne native-compatible submitted value with reset and required behavior.
Registrynerio add date-picker installs DatePicker, Calendar, Popover styling, and source dependencies.

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Use DatePicker for one custom, localizable ISO calendar date when native Input type=date is not sufficient.

Do / do not

Do
  • Use native Input type=date when direct keyboard text entry is required.
  • Use DatePicker for one custom, localizable calendar date.
  • Wrap it in Field or provide an explicit ARIA naming strategy.
Do not
  • Parse localized or natural-language text.
  • Add ranges, presets, time, timezone, availability, or scheduling.
  • Duplicate the form value with another named date input.

Tokens

LayerTokensControls
Form family--n-input-*Closed trigger states and density.
Overlay--n-overlay-* / --n-popover-*Anchored popup surface and motion.
Calendar--n-calendar-*Month grid, days, selection, and constraints.
Focus--n-focus-ringTrigger and Calendar focus visibility.