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
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<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
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et 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
Emplacements de contenu exposés par ce composant.
- #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
Événements émis par ce composant.
- @update:yearnumber
- Fired when a year tile is clicked. Payload is the four-digit year.
API
Membres exposés
Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.
- <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.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- Container height. Overflow-y: scroll. Overridden via the height prop (IDimensionProps).
Inclusion
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Rôles ARIA
Interactions clavier
| Touche | 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.
Fondation
Design tokens
Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.
- colorvar(--origam-color__action--primary---bg)
- Active year button background (driven by the color prop).
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Standalone year picker
Bounded year list
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.
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.