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.
<!-- Month Range Picker / Reporting Period -->
<script setup lang="ts">
import { MonthRangePickerRoot, MonthRangePickerAnchor, MonthRangePickerStartInput, MonthRangePickerEndInput, MonthRangePickerTrigger, MonthRangePickerContent, MonthRangePickerPreviousYear, MonthRangePickerNextYear, MonthRangePickerGrid, MonthRangePickerCell } from '@sectile/vue/month-range-picker'
import { CalendarDays } from '@lucide/vue'
const reportingPeriod = {
start: { year: 2026, month: 4, day: 1 },
end: { year: 2026, month: 9, day: 1 },
}
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
</script>
<template>
<MonthRangePickerRoot :default-value="reportingPeriod" v-slot="{ months, view }">
<MonthRangePickerAnchor>
<MonthRangePickerStartInput aria-label="First month" />
<MonthRangePickerEndInput aria-label="Last month" />
<MonthRangePickerTrigger class="catalog-picker-trigger" aria-label="Open month range picker">
<CalendarDays :size="18" aria-hidden="true" />
</MonthRangePickerTrigger>
</MonthRangePickerAnchor>
<MonthRangePickerContent>
<MonthRangePickerPreviousYear aria-label="Previous year">‹</MonthRangePickerPreviousYear>
<strong>{{ view.year }}</strong>
<MonthRangePickerNextYear aria-label="Next year">›</MonthRangePickerNextYear>
<MonthRangePickerGrid>
<MonthRangePickerCell v-for="month in months.flat()" :key="month.year + '-' + month.month" :value="month">
{{ monthNames[month.month - 1] }}
</MonthRangePickerCell>
</MonthRangePickerGrid>
</MonthRangePickerContent>
</MonthRangePickerRoot>
</template>Bounded
Reject values outside the configured minimum and maximum.
Reject values outside the configured minimum and maximum.
<!-- Month Range Picker / Bounded -->
<script setup lang="ts">
import { MonthRangePickerRoot, MonthRangePickerAnchor, MonthRangePickerStartInput, MonthRangePickerEndInput, MonthRangePickerTrigger, MonthRangePickerContent, MonthRangePickerPreviousYear, MonthRangePickerNextYear, MonthRangePickerGrid, MonthRangePickerCell } from '@sectile/vue/month-range-picker'
import { CalendarDays } from '@lucide/vue'
const reportingPeriod = {
start: { year: 2026, month: 4, day: 1 },
end: { year: 2026, month: 9, day: 1 },
}
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
</script>
<template>
<MonthRangePickerRoot :default-value="reportingPeriod" v-slot="{ months, view }">
<MonthRangePickerAnchor>
<MonthRangePickerStartInput aria-label="First month" />
<MonthRangePickerEndInput aria-label="Last month" />
<MonthRangePickerTrigger class="catalog-picker-trigger" aria-label="Open month range picker">
<CalendarDays :size="18" aria-hidden="true" />
</MonthRangePickerTrigger>
</MonthRangePickerAnchor>
<MonthRangePickerContent>
<MonthRangePickerPreviousYear aria-label="Previous year">‹</MonthRangePickerPreviousYear>
<strong>{{ view.year }}</strong>
<MonthRangePickerNextYear aria-label="Next year">›</MonthRangePickerNextYear>
<MonthRangePickerGrid>
<MonthRangePickerCell v-for="month in months.flat()" :key="month.year + '-' + month.month" :value="month">
{{ monthNames[month.month - 1] }}
</MonthRangePickerCell>
</MonthRangePickerGrid>
</MonthRangePickerContent>
</MonthRangePickerRoot>
</template>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.
<!-- Month Range Picker / Controlled -->
<script setup lang="ts">
import { ref } from 'vue'
import { MonthRangePickerRoot, MonthRangePickerAnchor, MonthRangePickerStartInput, MonthRangePickerEndInput, MonthRangePickerTrigger, MonthRangePickerContent, MonthRangePickerPreviousYear, MonthRangePickerNextYear, MonthRangePickerGrid, MonthRangePickerCell } from '@sectile/vue/month-range-picker'
import { CalendarDays } from '@lucide/vue'
const reportingPeriod = {
start: { year: 2026, month: 4, day: 1 },
end: { year: 2026, month: 9, day: 1 },
}
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
const value = ref(reportingPeriod)
</script>
<template>
<MonthRangePickerRoot v-model="value" v-slot="{ months, view }">
<MonthRangePickerAnchor>
<MonthRangePickerStartInput aria-label="First month" />
<MonthRangePickerEndInput aria-label="Last month" />
<MonthRangePickerTrigger class="catalog-picker-trigger" aria-label="Open month range picker">
<CalendarDays :size="18" aria-hidden="true" />
</MonthRangePickerTrigger>
</MonthRangePickerAnchor>
<MonthRangePickerContent>
<MonthRangePickerPreviousYear aria-label="Previous year">‹</MonthRangePickerPreviousYear>
<strong>{{ view.year }}</strong>
<MonthRangePickerNextYear aria-label="Next year">›</MonthRangePickerNextYear>
<MonthRangePickerGrid>
<MonthRangePickerCell v-for="month in months.flat()" :key="month.year + '-' + month.month" :value="month">
{{ monthNames[month.month - 1] }}
</MonthRangePickerCell>
</MonthRangePickerGrid>
</MonthRangePickerContent>
</MonthRangePickerRoot>
</template>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
MonthRangePickerRootMonthRangePickerTriggerMonthRangePickerAnchorMonthRangePickerPortalMonthRangePickerContentMonthRangePickerGridMonthRangePickerCellMonthRangePickerStartInputMonthRangePickerEndInputMonthRangePickerPreviousYearMonthRangePickerNextYear
Props
MonthRangePickerRootProps
alignAlignment of positioned content relative to its anchor.
asElement or component rendered for this part.
asChildWhether to merge this part into its single child instead of rendering a wrapper.
avoidCollisionsWhether positioned content may flip or shift to remain visible.
collisionBoundaryBoundary used to keep positioned content visible.
collisionPaddingSpace kept between positioned content and its collision boundary.
defaultHighlightedValueInitially highlighted value for uncontrolled state.
defaultOpenInitial uncontrolled open state.
defaultValueInitial value used when the component owns its state.
defaultViewInitial calendar or picker view.
disabledWhether interaction is unavailable.
hideWhenDetachedWhether positioned content hides when its anchor leaves the layout.
highlightedValueValue currently highlighted for keyboard interaction.
labelAccessible name announced for the control.
modelValueCurrent value when state is controlled by the parent.
openWhether the associated popup or disclosure is open.
policiesBehavior policies that customize validation, movement, or selection.
positionWhether the popup is positioned relative to its trigger.
readonlyWhether the value can be inspected but not changed.
referenceDateDeterministic civil date used when a calendar has no selected or highlighted value.
requiredWhether the control must contain a valid value before submission.
sidePreferred side of the anchor for positioned content.
sideOffsetDistance between positioned content and its anchor.
strategyCSS positioning strategy used for anchored content.
trackingUpdate strategy used while anchored content is open.
MonthRangePickerPartProps
asElement or component rendered for this part.
asChildWhether to merge this part into its single child instead of rendering a wrapper.
MonthRangePickerPortalProps
deferWhether Teleport target resolution waits until the end of the current mount or update tick.
disabledWhether interaction is unavailable.
toTeleport target for portalled content.
Slots
MonthRangePickerRootSlotProps
datesDates projected by the active view.
disabledWhether interaction is unavailable.
highlightedValueValue currently highlighted for interaction.
monthsMonths projected by the active view.
openWhether the associated popup or disclosure is open.
readonlyWhether the value can be inspected but not changed.
valueCurrent value exposed by this contract.
viewCurrent calendar anchor.
viewModeActive calendar view mode.
yearsYears projected by the active view.
MonthRangePickerCellSlotProps
disabledWhether interaction is unavailable.
highlightedWhether this item is highlighted for interaction.
inRangeWhether this value lies inside the selected range.
selectedWhether this item is selected.
valueCurrent value exposed by this contract.
Other types
MonthRangePickerValueChangeHandler
type MonthRangePickerValueChangeHandler = NonNullable<InstanceType<typeof MonthRangePickerRoot>['$props']['onUpdate:modelValue']>MonthRangePickerOpenChangeHandler
type MonthRangePickerOpenChangeHandler = NonNullable<InstanceType<typeof MonthRangePickerRoot>['$props']['onUpdate:open']>MonthRangePickerHighlightedValueChangeHandler
type MonthRangePickerHighlightedValueChangeHandler = NonNullable<InstanceType<typeof MonthRangePickerRoot>['$props']['onUpdate:highlightedValue']>MonthRangePickerValue
| Name | Type | Required |
|---|---|---|
start | DateValue | Yes |
end | DateValue | Yes |
MonthPickerValue
| Name | Type | Required |
|---|---|---|
year | number | Yes |
month | number | Yes |
day | number | Yes |
Parts
Shared scope: [data-scope="month-range-picker"]. Combine it with a part selector to keep styles local to this component.
| Part | Selector | Role | Extra 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
| Key | Behavior |
|---|---|
| Arrow keys | Move between months in the year grid. |
| Page Up / Page Down | Move to the previous or next year. |
| Enter / Space | Select the highlighted month. |
| Escape | Close the month grid without changing the value. |
Accessibility
Start and end month inputs share one year grid while retaining independently named endpoints.
