Skip to content

HyDatePicker

Usage examples on this page are written for Lit / plain HTML (<hy-date-picker>). The same component ships as HyDatePicker in @whitespaceux/harmony-react (native React 19), with typed wrappers for Angular, Solid, Svelte, and Vue. The API reference below applies to all frameworks.

The full date form control: an editable hy-date-field (segmented input) plus an hy-popover-hosted hy-calendar. Mirrors hy-color-picker's form-associated host + popover + custom interior architecture.

type="datetime" enables the field's time segments; range switches to two fields + a range calendar. Value is a single ISO YYYY-MM-DD[THH:MM] or, in range mode, an ISO 8601 interval start/end. On form submit the JS value is projected to two scalar fields ({name}.start / {name}.end) in range mode — see DATETIME_COMPONENTS_PLAN.md §3.

Examples

html
<hy-date-picker label="Date" value="2026-03-07"></hy-date-picker>
<hy-date-picker label="Stay" range value="2026-03-07/2026-03-10"></hy-date-picker>

API

Properties

PropertyAttributeTypeDefaultDescription
valuevaluestring''Selected value — ISO YYYY-MM-DD[THH:MM], or ISO interval start/end in range mode.
typetype'date' | 'datetime''date'date (default) or datetime (adds a time segment to the field).
rangerangebooleanfalseRange selection — one interval value, two form fields, one popover.
minminstring | undefined
maxmaxstring | undefined
localelocalestring | undefined
placementplacement'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end''bottom-start'
openopenbooleanfalse
labellabelstring''
helpTexthelp-textstring''
errorMessageerror-messagestring''
invalidinvalidbooleanfalse
disableddisabledbooleanfalse
namenamestring''
sizesize'small' | 'medium' | 'large''medium'
widthwidthstring | undefined
autofocusautofocusbooleanfalse
formHTMLFormElement | null
validityValidityState

Events

EventDetailDescription
inputFires on each calendar/field selection.
changeFires once the value is committed.

CSS Parts

PartDescription
baseOuter wrapper
labelThe visible label
controlThe trigger row (field(s) + calendar button)
calendar-buttonThe calendar-toggle button
surfaceThe popover surface
shortcutsThe shortcut row (Today / Clear) inside the surface
shortcut-todayThe Today shortcut button
shortcut-clearThe Clear shortcut button
helper-textHelper text
error-messageError message when invalid

CSS Custom Properties

PropertyDescription
--hy-date-picker-gapGap between the fields and calendar button

Built with Lit. Documented with VitePress.