YearPicker

Year-only field — combobox trigger with paginated year grid.

Preview

Live

<div class="ui-year">
  <button type="button" class="ui-year__trigger field-control" role="combobox"
    aria-haspopup="dialog" aria-expanded="false" aria-labelledby="year-label">
    <span class="ui-icon ui-icon--calendar ui-year__calendar" aria-hidden="true"></span>
    <span class="ui-year__value">2022</span>
    <span class="ui-icon ui-icon--chevron-down ui-year__chevron" aria-hidden="true"></span>
  </button>
</div>
<!-- Panel: .ui-year__panel[role=dialog] with yearbar + year cells -->

Variants

Empty

.is-empty placeholder state.

Invalid

.is-invalid validation state.

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 YearPicker).

API

HTML classes

Class Description
.ui-year / .is-open / .is-empty / .is-invalid Root states.
.ui-year__trigger / __value / __calendar / __chevron Combobox chrome.
.ui-year__panel / __yearbar / __year / __nav Year dialog.

React props

From src/core/YearPicker.tsx — value is a year string (e.g. "2022").

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.
prevYearsLabel / nextYearsLabel string Page nav aria-labels (required).