Components

Year Range Picker

Accessible year-level range selection with preview, limits, fixed endpoints, and paging.

YearRangePicker selects inclusive year ranges. It combines Year Picker's paged grid and roving focus with range anchoring, preview, maximum length, non-contiguous rules, and fixed endpoints.

Anatomy

  • #previous: Previous-page control content.
  • #heading: Visible year-range heading.
  • #next: Next-page control content.
  • #year: Year content with range and availability state.
  • #footer: Optional content after grid.

Usage

2024 – 2035

Range: 2026 - 2029

Examples

Maximum range

maximumYears counts both endpoints and rejects a longer second selection.

<YearRangePicker v-model="range" :maximum-years="5" />

Fixed boundary

<YearRangePicker
  v-model="range"
  fixed-date="start"
/>

The fixed endpoint must exist. Selections before a fixed start, or after a fixed end, are rejected.

Custom page shape

<YearRangePicker :years-per-page="16" :columns="4" />

Unavailable years

<YearRangePicker
  :is-year-unavailable="date => suspendedYears.has(date.year)"
  allow-non-contiguous-ranges
/>

Without allowNonContiguousRanges, blocked interior years reject the range. Endpoints always remain selectable.

API Reference

Models

ModelTypeDefaultDescription
v-modelCalendarDateRange{}Optional start and end years normalized to January 1.
v-model:placeholderCalendarDateValueselected start or todayFirst visible year.

Props

PropTypeDefaultDescription
localestring"en-US"Locale used for labels.
dir"ltr" | "rtl""ltr"Reading direction.
calendarLabelstring"Year range picker"Accessible root label.
columnsnumber3Visual grid columns.
yearsPerPagenumber12Visible years and paging distance.
allowNonContiguousRangesbooleanfalseAllows blocked interior years.
maximumYearsnumberMaximum inclusive range length.
fixedDate"start" | "end"Keeps one endpoint fixed.
disabledbooleanfalseDisables paging and selection.
readOnlybooleanfalseAllows navigation but blocks selection.
initialFocusbooleanfalseFocuses selected/current year on mount.
minValue / maxValueCalendarDateValueSelection and paging boundaries.
isYearDisabled(date) => booleanMarks years disabled.
isYearUnavailable(date) => booleanMarks years unavailable.
nextPage / prevPage(placeholder) => CalendarDateValuepage arithmeticCustom page calculations.
uiYearRangePickerUiClasses for generated parts.

Emits

EventPayloadDescription
update:modelValueCalendarDateRangeFires after accepted range changes.
update:placeholderCalendarDateValueFires after accepted page changes.
value-change(range, details)Cancelable range change.
placeholder-change(date, details)Cancelable page change.

Slots

SlotPropsDescription
previousdisabledPrevious control content.
headinglabel, itemsVisible year-range heading.
nextdisabledNext control content.
yeardate, label, selected, rangeStart, rangeEnd, inRange, highlighted, disabled, unavailable, focusedYear content and range state.
footervalue, placeholderOptional content after grid.

Methods

MethodDescription
focusValue(date)Moves roving focus to a year and pages when needed.
selectValue(date, event?)Requests an endpoint selection.
nextPage(event?)Requests the next year page.
previousPage(event?)Requests the previous year page.

UI Options

KeyPart
rootRoot range group.
headerNavigation header.
previousPrevious-page button.
headingLive year-range heading.
nextNext-page button.
gridARIA year grid.
gridRowGrid row.
cellGrid cell.
cellTriggerInteractive year button.
footerOptional footer.

Styling Hooks

UI keyCSS classData attributes
root.akaza-year-range-picker`data-akaza-state="empty
header.akaza-year-range-picker-header
previous.akaza-year-range-picker-previousdata-akaza-disabled
heading.akaza-year-range-picker-heading
next.akaza-year-range-picker-nextdata-akaza-disabled
grid.akaza-year-range-picker-grid
gridRow.akaza-year-range-picker-grid-row
cell.akaza-year-range-picker-cellSelection, range, highlight, and availability attributes listed below.
cellTrigger.akaza-year-range-picker-cell-triggerdata-akaza-state, data-akaza-selected, data-akaza-today, data-akaza-range-start, data-akaza-range-end, data-akaza-in-range, data-akaza-highlighted, data-akaza-disabled, data-akaza-unavailable
footer.akaza-year-range-picker-footer

Keyboard

KeyBehavior
Arrow keysMove by one year or one visual row. Horizontal movement reverses in RTL.
Home / EndMoves to row boundary.
PageUp / PageDownMoves one page.
Shift + PageUp / Shift + PageDownMoves ten pages.
Enter / SpaceSets range start or completes range end.

Pointer hover and keyboard focus preview a pending range. Touch input selects each endpoint.