Skip to content

Month Range Picker

Choose an inclusive span of calendar months from one year grid.

Usage

Reporting period

Choose the first and last month included in a report.

Choose the first and last month included in a report.

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/month-range-picker

Components
  • MonthRangePickerRoot
  • MonthRangePickerTrigger
  • MonthRangePickerAnchor
  • MonthRangePickerPortal
  • MonthRangePickerContent
  • MonthRangePickerGrid
  • MonthRangePickerCell
  • MonthRangePickerStartInput
  • MonthRangePickerEndInput
  • MonthRangePickerPreviousYear
  • MonthRangePickerNextYear

Props

MonthRangePickerRootProps

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.

MonthRangePickerPartProps

as

Element or component rendered for this part.

asChild

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

MonthRangePickerPortalProps

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

MonthRangePickerRootSlotProps

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.

MonthRangePickerCellSlotProps

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

MonthRangePickerValueChangeHandler

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

MonthRangePickerOpenChangeHandler

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

MonthRangePickerHighlightedValueChangeHandler

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

MonthRangePickerValue

NameTypeRequired
startDateValueYes
endDateValueYes

MonthPickerValue

NameTypeRequired
yearnumberYes
monthnumberYes
daynumberYes

Parts

Shared scope: [data-scope="month-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-year[data-part="previous-year"]Moves to the previous year.
next-year[data-part="next-year"]Moves to the next year.

Keyboard interaction

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

Accessibility

Start and end month inputs share one year grid while retaining independently named endpoints.

Released under the MIT License.