DatePickerYears
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.
<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.
- minunknowncurrentYear - 100
- Minimum year to include in the list. Derived from the year portion of the min date. Defaults to 100 years before today.
- maxunknowncurrentYear + 52
- Maximum year to include in the list. Derived from the year portion of the max date. Defaults to 52 years after today.
- yearnumber
- Currently selected year. The matching tile is highlighted and auto-scrolled into view on mount.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- color
- Intent or custom colour applied to the selected year button.
- heightnumber | string288px
- Height of the years container. Overflow-y: scroll enables the virtual scroll. Defaults to 288px.
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- widthnumber | 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:yearnumber
- 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
Keyboard interactions
| Key | Action |
|---|---|
| Enter / Space | Selects the focused year. |
| Tab | Moves 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.
- colorvar(--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
Bounded year list
Ecosystem
Family
Components from the same folder that share conventions and often compose together.
DatePicker
Calendar popup to select a single date, multiple dates or a range.
DatePickerControls
Navigation bar with prev/next and view-mode toggle buttons.
DatePickerHeader
Coloured header strip showing the selected date or month.
DatePickerMonth
Day-grid view for picking a date within the current month.
DatePickerMonths
Month-grid view for picking a month within the current year.