Skip to content
Alea
Pro
  1. Alea
  2. Components
  3. Data entry
  4. YearPicker

Data entry

YearPicker

A grid of 12 years, with the range in the header and buttons for the previous and next years: for a fiscal year, a model year or a quick jump to a birth year. It moves like a calendar with the keyboard, and years outside the limits are shown but cannot be chosen.

import { YearPicker } from '@alea-design/ui';

Examples

Fiscal year

Choose a year from a page of 12: arrows and Home, End, Page Up and Page Down move like a calendar, and years outside the limits cannot be picked.

Tokens

The design tokens this component reads, with their value in the current theme. Override any of them to restyle it.

Color

  • --alea-chip-bg…
  • --alea-chip-text…
  • --alea-focus…
  • --alea-surface-hover…
  • --alea-text…
  • --alea-text-faint…
  • --alea-text-muted…

Space

  • --alea-space-1…
  • --alea-space-2…

Radius

  • --alea-radius-full…
  • --alea-radius-md…

Type

  • --alea-font-family-body…
  • --alea-font-size-md…
  • --alea-font-weight-regular…
  • --alea-font-weight-semibold…

Motion

  • --alea-motion-duration-fast…
  • --alea-motion-ease-standard…

Component

  • --alea-hit-min…

Props

YearPicker props

A grid of 12 years with the range in the header: for a fiscal year, a model year or a quick jump to a birth year. The keyboard moves like a calendar: arrows by year and by row, Home and End to the first and last year of the page, Page Up and Page Down by page. Years outside minValue and maxValue are shown but cannot be chosen. The page shown first holds the chosen year, or this year when there is none.

PropTypeDefaultDescription
aria-labelstringnoneNames the picker for screen readers. Needed when it has no visible label.
classNamestringnoneExtra class names for the root element.
defaultValuenumber | nullnullThe year at first (uncontrolled).
isDisabledbooleanfalse
maxValuenumbernoneThe latest year that can be chosen.
minValuenumbernoneThe earliest year that can be chosen.
onChange((year: number) => void)noneCalled when the value changes.
valuenumber | nullnoneThe chosen year (controlled). null for none.

Specs

Generated from the source: the variants in the types, the states and tokens in the CSS, and the motion patterns that apply. The grids render the real component in both themes; the numbers are measured from the page.

States
Hover (CSS)DisabledSelectedKeyboard focus
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-monthpicker.alea-yearpicker.alea-monthpicker-head.alea-monthpicker-nav.alea-monthpicker-title.alea-monthpicker-grid.alea-monthpicker-row.alea-monthpicker-cell
Data attributes
data-density=touch

Accessibility

  • It is a grid of years: one tab stop, then the arrows move inside it, so it never adds 12 stops to the page.
  • Each year is named by its number and says whether it is selected; years outside the limits are marked as disabled.
  • The range of years is a heading that is announced politely when the page changes, and the two page buttons are named "Previous years" and "Next years".
  • In right-to-left languages the arrow keys and the page arrows swap sides.

Keyboard

KeyDoes
TabEnters and leaves the grid (one stop)
Arrow Left or RightPrevious or next year; at the edge of a page it changes the page
Arrow Up or DownThe year one row up or down (four years)
Home or EndFirst or last year of the page
Page Up or Page DownThe same place in the previous or next 12 years
Enter or SpaceChooses the focused year

Do and don't

Do

  • Give it an aria-label when there is no visible label next to it.
  • Set minValue and maxValue when the years have limits: the years stay visible but cannot be chosen.
  • Use it when only the year matters; use MonthPicker when the month matters too.

Don't

  • Don't use it for a month or a day: that is MonthPicker and DatePicker.
  • Don't hide years that cannot be chosen: people need to see why.

In Figma

The properties of the Figma components, generated from the kit, so they always match it. The last column is the React prop each one stands for.

Year picker · 2 variants

Figma propertyKindValuesDefaultReact prop
SelectedVariant2026, None2026defaultValue
Tested with axe, keyboard and screen reader roles