Month Picker
Choose one calendar month from a focused year grid.
Usage
Billing month
Choose the calendar month used for the next billing cycle.
Choose the calendar month used for the next billing cycle.
<!-- Month Picker / Billing Month -->
<script setup lang="ts">
import { MonthPickerRoot, MonthPickerAnchor, MonthPickerInput, MonthPickerTrigger, MonthPickerContent, MonthPickerPreviousYear, MonthPickerNextYear, MonthPickerGrid, MonthPickerCell } from '@sectile/vue/month-picker'
import { CalendarDays } from '@lucide/vue'
const billingMonth = { year: 2026, month: 8, day: 1 }
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
</script>
<template>
<MonthPickerRoot :default-value="billingMonth" v-slot="{ months, view }">
<MonthPickerAnchor>
<MonthPickerInput aria-label="Billing month" />
<MonthPickerTrigger class="catalog-picker-trigger" aria-label="Open month picker">
<CalendarDays :size="18" aria-hidden="true" />
</MonthPickerTrigger>
</MonthPickerAnchor>
<MonthPickerContent>
<MonthPickerPreviousYear>‹</MonthPickerPreviousYear>
<strong>{{ view.year }}</strong>
<MonthPickerNextYear>›</MonthPickerNextYear>
<MonthPickerGrid>
<MonthPickerCell v-for="month in months.flat()" :key="month.year + '-' + month.month" :value="month">
{{ monthNames[month.month - 1] }}
</MonthPickerCell>
</MonthPickerGrid>
</MonthPickerContent>
</MonthPickerRoot>
</template>Fiscal year
Move by year and choose one month from the active fiscal calendar.
Move by year and choose one month from the active fiscal calendar.
<!-- Month Picker / Fiscal Year -->
<script setup lang="ts">
import { MonthPickerRoot, MonthPickerAnchor, MonthPickerInput, MonthPickerTrigger, MonthPickerContent, MonthPickerPreviousYear, MonthPickerNextYear, MonthPickerGrid, MonthPickerCell } from '@sectile/vue/month-picker'
import { CalendarDays } from '@lucide/vue'
const billingMonth = { year: 2026, month: 8, day: 1 }
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
</script>
<template>
<MonthPickerRoot :default-value="billingMonth" v-slot="{ months, view }">
<MonthPickerAnchor>
<MonthPickerInput aria-label="Billing month" />
<MonthPickerTrigger class="catalog-picker-trigger" aria-label="Open month picker">
<CalendarDays :size="18" aria-hidden="true" />
</MonthPickerTrigger>
</MonthPickerAnchor>
<MonthPickerContent>
<MonthPickerPreviousYear>‹</MonthPickerPreviousYear>
<strong>{{ view.year }}</strong>
<MonthPickerNextYear>›</MonthPickerNextYear>
<MonthPickerGrid>
<MonthPickerCell v-for="month in months.flat()" :key="month.year + '-' + month.month" :value="month">
{{ monthNames[month.month - 1] }}
</MonthPickerCell>
</MonthPickerGrid>
</MonthPickerContent>
</MonthPickerRoot>
</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 Picker / Controlled -->
<script setup lang="ts">
import { ref } from 'vue'
import { MonthPickerRoot, MonthPickerAnchor, MonthPickerInput, MonthPickerTrigger, MonthPickerContent, MonthPickerPreviousYear, MonthPickerNextYear, MonthPickerGrid, MonthPickerCell } from '@sectile/vue/month-picker'
import { CalendarDays } from '@lucide/vue'
const billingMonth = { year: 2026, month: 8, day: 1 }
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
const value = ref(billingMonth)
</script>
<template>
<MonthPickerRoot v-model="value" v-slot="{ months, view }">
<MonthPickerAnchor>
<MonthPickerInput aria-label="Billing month" />
<MonthPickerTrigger class="catalog-picker-trigger" aria-label="Open month picker">
<CalendarDays :size="18" aria-hidden="true" />
</MonthPickerTrigger>
</MonthPickerAnchor>
<MonthPickerContent>
<MonthPickerPreviousYear>‹</MonthPickerPreviousYear>
<strong>{{ view.year }}</strong>
<MonthPickerNextYear>›</MonthPickerNextYear>
<MonthPickerGrid>
<MonthPickerCell v-for="month in months.flat()" :key="month.year + '-' + month.month" :value="month">
{{ monthNames[month.month - 1] }}
</MonthPickerCell>
</MonthPickerGrid>
</MonthPickerContent>
</MonthPickerRoot>
</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-picker
MonthPickerRootMonthPickerTriggerMonthPickerAnchorMonthPickerPortalMonthPickerContentMonthPickerGridMonthPickerCellMonthPickerInputMonthPickerPreviousYearMonthPickerNextYear
Props
MonthPickerRootProps
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.
MonthPickerPartProps
asElement or component rendered for this part.
asChildWhether to merge this part into its single child instead of rendering a wrapper.
MonthPickerPortalProps
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
MonthPickerRootSlotProps
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.
MonthPickerCellSlotProps
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
MonthPickerValueChangeHandler
type MonthPickerValueChangeHandler = NonNullable<InstanceType<typeof MonthPickerRoot>['$props']['onUpdate:modelValue']>MonthPickerOpenChangeHandler
type MonthPickerOpenChangeHandler = NonNullable<InstanceType<typeof MonthPickerRoot>['$props']['onUpdate:open']>MonthPickerHighlightedValueChangeHandler
type MonthPickerHighlightedValueChangeHandler = NonNullable<InstanceType<typeof MonthPickerRoot>['$props']['onUpdate:highlightedValue']>MonthPickerValue
| Name | Type | Required |
|---|---|---|
year | number | Yes |
month | number | Yes |
day | number | Yes |
Parts
Shared scope: [data-scope="month-picker"]. Combine it with a part selector to keep styles local to this component.
| Part | Selector | Role | Extra attributes |
|---|---|---|---|
input | [data-part="input"] | Accepts the editable value or draft. | — |
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
The labeled input and trigger own a year grid whose cells expose selected, highlighted, and disabled month state.
