Skip to content

Year Range Picker

Choose an inclusive span of years from a paged year grid.

Usage

Roadmap horizon

Choose the first and last year included in a roadmap.

Choose the first and last year included in a roadmap.

Bounded

Reject values outside the configured minimum and maximum.

Reject values outside the configured minimum and maximum.

Controlled

Let the parent own the current value and apply accepted changes back to the component.

Let the parent own the current value and apply accepted changes back to the component.

Floating positioning

This component uses the shared positioning engine. Use the live positioning example to change side, align, offsets, collision boundaries, strategy, and tracking while inspecting the resolved placement.

API

Vue package: @sectile/vue/temporal/year-range-picker

Components
  • YearRangePickerRoot
  • YearRangePickerTrigger
  • YearRangePickerAnchor
  • YearRangePickerPortal
  • YearRangePickerContent
  • YearRangePickerGrid
  • YearRangePickerCell
  • YearRangePickerStartInput
  • YearRangePickerEndInput
  • YearRangePickerPreviousPage
  • YearRangePickerNextPage

Props

YearRangePickerRootProps

align

Alignment of positioned content relative to its anchor.

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

avoidCollisions

Whether positioned content may flip or shift to remain visible.

collisionBoundary

Boundary used to keep positioned content visible.

collisionPadding

Space kept between positioned content and its collision boundary.

defaultHighlightedValue

Initially highlighted value for uncontrolled state.

defaultOpen

Initial uncontrolled open state.

defaultValue

Initial value used when the component owns its state.

defaultView

Initial calendar or picker view.

disabled

Whether interaction is unavailable.

hideWhenDetached

Whether positioned content hides when its anchor leaves the layout.

highlightedValue

Value currently highlighted for keyboard interaction.

label

Accessible name announced for the control.

modelValue

Current value when state is controlled by the parent.

open

Whether the associated popup or disclosure is open.

policies

Behavior policies that customize validation, movement, or selection.

position

Whether the popup is positioned relative to its trigger.

readonly

Whether the value can be inspected but not changed.

referenceDate

Deterministic civil date used when a calendar has no selected or highlighted value.

required

Whether the control must contain a valid value before submission.

side

Preferred side of the anchor for positioned content.

sideOffset

Distance between positioned content and its anchor.

strategy

CSS positioning strategy used for anchored content.

tracking

Update strategy used while anchored content is open.

YearRangePickerPartProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

YearRangePickerPortalProps

defer

Whether Teleport target resolution waits until the end of the current mount or update tick.

disabled

Whether interaction is unavailable.

to

Teleport target for portalled content.

Slots

YearRangePickerRootSlotProps

dates

Dates projected by the active view.

disabled

Whether interaction is unavailable.

highlightedValue

Value currently highlighted for interaction.

months

Months projected by the active view.

open

Whether the associated popup or disclosure is open.

readonly

Whether the value can be inspected but not changed.

value

Current value exposed by this contract.

view

Current calendar anchor.

viewMode

Active calendar view mode.

years

Years projected by the active view.

YearRangePickerCellSlotProps

current

Whether this item represents the current position.

disabled

Whether interaction is unavailable.

highlighted

Whether this item is highlighted for interaction.

inRange

Whether this value lies inside the selected range.

selected

Whether this item is selected.

value

Current value exposed by this contract.

Other types

YearRangePickerValueChangeHandler

ts
type YearRangePickerValueChangeHandler = NonNullable<InstanceType<typeof YearRangePickerRoot>['$props']['onUpdate:modelValue']>

YearRangePickerOpenChangeHandler

ts
type YearRangePickerOpenChangeHandler = NonNullable<InstanceType<typeof YearRangePickerRoot>['$props']['onUpdate:open']>

YearRangePickerHighlightedValueChangeHandler

ts
type YearRangePickerHighlightedValueChangeHandler = NonNullable<InstanceType<typeof YearRangePickerRoot>['$props']['onUpdate:highlightedValue']>

YearRangePickerValue

NameTypeRequired
startDateValueYes
endDateValueYes

YearPickerValue

NameTypeRequired
yearnumberYes
monthnumberYes
daynumberYes

Parts

Shared scope: [data-scope="year-range-picker"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
start-input[data-part="start-input"]Edits the start value.
end-input[data-part="end-input"]Edits the end value.
anchor[data-part="anchor"]Provides the positioning reference for floating content.
trigger[data-part="trigger"]Opens, closes, or activates the associated content.
content[data-part="content"]Contains the component content shown for the active state.
grid[data-part="grid"]Groups cells into a navigable two-dimensional structure.
cell[data-part="cell"]Represents one navigable or selectable grid value.
previous-page[data-part="previous-page"]Moves to the previous page.
next-page[data-part="next-page"]Moves to the next page.

Keyboard interaction

KeyBehavior
Arrow keysMove between years in the active page.
Page Up / Page DownMove to the previous or next page of years.
Enter / SpaceSelect the highlighted year.
EscapeClose the year grid without changing the value.

Accessibility

Start and end year inputs share a paged grid and expose one inclusive year interval.

Released under the MIT License.