0.1.0

Date Input

Date inputs edit a single calendar date as locale-ordered month, day, and year segments. Set name on the host to submit the committed ISO value like a native date input. Use Date Field when you also need a calendar popup.

Try it

08202026

Usage

Bind value as ISO YYYY-MM-DD. locale controls segment order. The host is form-associated: name submits the committed ISO string through native FormData. An empty named value submits an empty string.

import { RuiDateInput } from '@ecopages/radiant-ui/date-input';
 
<RuiDateInput name="when" value="2026-08-20" locale="en-US" label="Start date" />

Derived tree

<rui-date-input> render()s the segment group. Do not stamp [data-date-segment] yourself. Date Field and Date Range Picker nest this host and copy name onto it.

Locale order

Segment order follows the locale. en-US is month/day/year; ja-JP is year/month/day.

20260820

Draft vs committed value

Typed digits stay in the focused segment until that unit completes, focus moves to another segment, or the control blurs. value and the form value stay on the last committed ISO date during that draft. An in-progress buffer is not published just because the draft happens to parse as a date.

Theming

Date Input surfaces map to semantic surface roles, never Tailwind palette steps:

PartCSS roles
Segments--text-control-input, --space-control-*
Segment texton-background
Placeholderon-surface + opacity-muted
Focused segment--focus-ring fill, --on-focus-ring text
Literal separatorson-background

Override at the theme layer, not in component CSS.

API

RuiDateInput is a custom element (<rui-date-input>). It is form-associated: name on this host lists the committed ISO value. Wrap in RuiField to register with RuiForm.

Attributes

AttributeTypeDefaultDescription
valuestring''Canonical ISO YYYY-MM-DD.
minstring''Earliest allowed ISO date.
maxstring''Latest allowed ISO date.
disabledbooleanfalseDisable editing.
read-onlybooleanfalseShow value without editing.
namestring''Form field name on this host. An empty value submits ''.
labelstring''Accessible name when there is no associated RuiLabel.
localestring''BCP 47 locale tag, or comma-separated fallback list.

Internal targets (generated)

TargetHost writesNotes
[data-ref="root"]id when labelled, role="group"segment group
[data-date-segment]data-focused, aria-*, contenteditableeditable month, day, or year unit

Events

EventDetailDescription
rui-change{ value: string }Emitted when a complete valid date is committed, or when all segments are cleared.
rui-form-reset—Emitted after native reset so a parent Date Field or Date Range Picker can restore its value.

View helpers

ComponentTarget stampedNotes
RuiDateInputdata-rui-control, data-rui-aria-targetSegment tree is host-rendered.

CSS classes

Public BEM classes on the generated tree:

ClassDescription
.rui-date-inputRoot column around the segment row.
.rui-date-input__segmentsSegment row.
.rui-date-input__segmentEditable month, day, or year unit.
.rui-date-input__segment--placeholderEmpty unit.
.rui-date-input__literalLocale separator between units.

Accessibility

  • Each unit is a spinbutton (textbox on iOS). Provide a visible RuiLabel or label on the host.
  • Arrow keys increment the focused unit or move between units. Digit keys replace the focused unit.
  • Disabled inputs leave the tab order.