DatePickerYears

Form & Input
stable

Scrollable year list for picking a year. Renders years in a 3-column grid from min to max (defaulting to ±100 years from today). Auto-scrolls to the selected year on mount.

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamDatePickerYearsSchematic of the DatePickerYears component showing a scrollable 3-column grid of year buttons. 2020 2021 2022 2023 2024 2025 2026 2026 2027 2028 2029 2030 … scrollable 1 2 3
Anatomy of <origam-date-picker-years> — 3 parts: ① root scroll container (288px height, overflow-y: scroll), ② 3-column grid content wrapper, ③ the active year button. On mount, the selected year scrolls into view via scrollIntoView({block: 'center'}).
1.origam-date-picker-years
Root container. Height 288px (default), overflow-y: scroll. Enables native browser scrolling to the selected year.
2.origam-date-picker-years__content
3-column CSS grid with justify-content: space-around. gap: 8px 24px. padding-inline: 32px. Inner OrigamBtn have padding-inline: 8px.
3OrigamBtn (active)
The selected year button. Receives active=true and color=props.color. All buttons have rounded=true. The active button is also assigned a template ref so scrollIntoView can target it on mount.

API

Props

All props accepted by this component, with their type, default value and description.

min
unknown
currentYear - 100
Minimum year to include in the list. Derived from the year portion of the min date. Defaults to 100 years before today.
max
unknown
currentYear + 52
Maximum year to include in the list. Derived from the year portion of the max date. Defaults to 52 years after today.
year
number
Currently selected year. The matching tile is highlighted and auto-scrolled into view on mount.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
color
Intent or custom colour applied to the selected year button.
height
number | string
288px
Height of the years container. Overflow-y: scroll enables the virtual scroll. Defaults to 288px.
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
width
number | string

API

Slots

Content slots exposed by this component.

#year
Custom year tile. Slot props expose the year descriptor ({ text, value }), its grid index, and the bound button props (active, color, rounded, text, onClick).

API

Emits

Events emitted by this component.

@update:year
number
Fired when a year tile is clicked. Payload is the four-digit year.

API

Exposed members

Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.

<T extends object>(props: T, exclude?: string[]) => Partial<T>
Utility to forward a filtered subset of props.
Ref<string>
Reactive CSS string generated by useStyle.
string
Unique style-sheet ID for this instance.
() => void
Injects the computed style sheet into the document.
() => void
Removes the injected style sheet from the document.
Ref<boolean>
True once the style sheet has been injected.

Customisation

CSS variables

CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.

Container height. Overflow-y: scroll. Overridden via the height prop (IDimensionProps).

Inclusion

Accessibility

ARIA roles, keyboard navigation and focus management. Sourced from the real component template.

ARIA roles

button

Keyboard interactions

Keyboard interactions
KeyAction
Enter / SpaceSelects the focused year.
TabMoves focus between year tiles.

Notes

  • On mount, the selected year is automatically scrolled into the centre of the visible area via scrollIntoView({block: "center"}), so users do not need to scroll manually to find the current year.

Foundation

Design tokens

Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.

Source
color
var(--origam-color__action--primary---bg)
Active year button background (driven by the color prop).

Interactive

Playground

Edit props live and see the component update in real time. The generated code snippet updates as you change values.

Rendering the live preview…

Usage

Examples

Ready-to-paste code snippets for your templates.

Standalone year picker

vue

Bounded year list

vue

Ecosystem

Family

Components from the same folder that share conventions and often compose together.