DatePicker

Day-level date field — combobox trigger with month grid calendar panel.

Preview

Live

<div class="ui-date">
  <button type="button" class="ui-date__trigger field-control" role="combobox"
    aria-haspopup="dialog" aria-expanded="false" aria-labelledby="date-label">
    <span class="ui-icon ui-icon--calendar ui-date__calendar" aria-hidden="true"></span>
    <span class="ui-date__value">Jun 15, 2024</span>
    <span class="ui-icon ui-icon--chevron-down ui-date__chevron" aria-hidden="true"></span>
  </button>
</div>
<!-- Panel (portaled when open): .ui-date__panel[role=dialog] with monthbar + grid -->

Variants

Empty

.is-empty shows placeholder styling.

Invalid

.is-invalid on the root.

Accessibility

  • Trigger is a combobox; calendar/panel uses role="dialog" with panelLabel.
  • Wire a visible field label via aria-labelledby or aria-label.
  • Nav buttons need accessible names (prev* / next* labels).
  • Escape closes the panel and returns focus to the trigger (React DatePicker).
  • Provide clearLabel for the clear control in the panel.

API

HTML classes

Class Description
.ui-date / .is-open / .is-empty / .is-invalid Root states.
.ui-date__trigger / __value / __calendar / __chevron Combobox chrome.
.ui-date__panel / __monthbar / __month / __nav Calendar dialog.
.ui-date__weekdays / __grid / __cell Day grid.

React props

From src/core/DatePicker.tsx — value is a local date string (YYYY-MM-DD).

Prop Type Default Description
value / onChange string / fn Controlled ISO-ish value (required).
placeholder string Empty display text (required).
panelLabel string Dialog accessible name (required).
disabled / invalid boolean false Disabled / invalid states.
aria-* string label, labelledby, describedby.
prevMonthLabel / nextMonthLabel string Month nav aria-labels (required).
clearLabel string Clear control label (required).
monthLabels / weekdayLabels readonly string[] defaults Optional i18n label arrays.