Month Picker
Select one or more months from a grid.
Demos
Size
2026
Usage
vue
<script setup lang="ts">
import { Accordion } from '~/components/ui/accordion'
const items = [
{ value: 'source', label: 'Do I own the source?', content: 'Yes. Copy and adapt the files.' },
]
</script>
<template>
<Accordion :items="items" />
</template>
Installation
Complete the shared installation. Copy MonthPicker.vue and index.ts into app/components/ui/month-picker/.
app/components/ui/month-picker/MonthPicker.vue
<script setup lang="ts">
import { AlertDialog as Primitive } from 'akaza-ui'
import { computed, useAttrs, useTemplateRef } from 'vue'
import { cn } from '../../../utils/ui'
import uiConfig from '../ui.config'
import {
alertDialogVariants,
resolveAlertDialogVariants,
type AlertDialogProps,
type AlertDialogSlots,
} from './index'
defineOptions({ inheritAttrs: false })
// Preserve Akaza defaults when optional props, including Boolean aliases, are omitted.
const props = withDefaults(defineProps<AlertDialogProps>(), {
as: undefined,
teleport: undefined,
transition: undefined,
duration: undefined,
title: undefined,
ariaLabel: undefined,
description: undefined,
ui: undefined,
modelValue: undefined,
})
defineSlots<AlertDialogSlots>()
const attrs = useAttrs()
const styles = computed(() => alertDialogVariants(resolveAlertDialogVariants(props, uiConfig)))
const mergedUi = computed(() => {
const overrides = props.ui as Record<string, string | undefined> | undefined
return Object.fromEntries(
Object.entries(styles.value).map(([part, style]) => [
part,
cn(style(), overrides?.[part], part === 'content' ? props.class : undefined),
]),
)
})
const primitiveProps = computed(() => {
const { class: _class, ui: _ui, width: _width, ...native } = props
return native
})
const primitive = useTemplateRef<InstanceType<typeof Primitive>>('primitive')
defineExpose({
get open() {
return primitive.value!.open
},
get close() {
return primitive.value!.close
},
get toggle() {
return primitive.value!.toggle
},
get titleId() {
return primitive.value!.titleId
},
get descriptionId() {
return primitive.value!.descriptionId
},
})
</script>
<template>
<component
:is="Primitive"
ref="primitive"
v-bind="{ ...primitiveProps, ...attrs }"
:ui="mergedUi"
>
<template v-for="(_, name) in $slots" #[name]="scope"
><slot :name="name as keyof AlertDialogSlots" v-bind="scope ?? {}"
/></template>
</component>
</template>
API
Variants and defaults
| Prop | Values | Default |
|---|---|---|
size | xs, sm, md, lg, xl | sm |
Models
| Model | Type | Default | Description |
|---|---|---|---|
v-model | CalendarDateValue | CalendarDateValue[] | undefined | undefined | Selected month or selected months when multiple is enabled. Values are normalized to day 1. |
v-model:placeholder | CalendarDateValue | selected month or today | Year displayed by the grid. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
locale | string | "en-US" | Locale used for month and year labels. |
dir | "ltr" | "rtl" | "ltr" | Reading direction and horizontal arrow behavior. |
calendarLabel | string | "Month picker" | Accessible root label. |
columns | number | 3 | Number of month columns. |
multiple | boolean | false | Enables independent multiple selection. |
preventDeselect | boolean | false | Prevents removing an already selected month. |
disabled | boolean | false | Disables paging and selection. |
readOnly | boolean | false | Allows navigation but blocks selection. |
initialFocus | boolean | false | Focuses the selected month, current month, or first visible month on mount. |
minValue | CalendarDateValue | — | Earliest selectable month and page boundary. |
maxValue | CalendarDateValue | — | Latest selectable month and page boundary. |
isMonthDisabled | (date) => boolean | — | Marks a month disabled by application rules. |
isMonthUnavailable | (date) => boolean | — | Marks a month unavailable. |
nextPage | (placeholder) => CalendarDateValue | add one year | Custom next-page calculation. |
prevPage | (placeholder) => CalendarDateValue | subtract one year | Custom previous-page calculation. |
ui | MonthPickerUi | — | Classes for generated parts. |
Slots
| Slot | Props | Description |
|---|---|---|
previous | disabled | Previous control content. |
heading | label, items | Current year heading. |
next | disabled | Next control content. |
month | date, label, selected, today, disabled, unavailable, focused | Month button content and state. |
footer | value, placeholder | Optional content after grid. |
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue | value | Fires after accepted selection changes. |
update:placeholder | date | Fires after accepted page changes. |
value-change | (value, details) | Fires before selection. details.cancel() prevents update. |
placeholder-change | (date, details) | Fires before paging. details.cancel() prevents update. |
Keyboard
| Key | Behavior |
|---|---|
ArrowLeft / ArrowRight | Moves one month, reversed in RTL. |
ArrowUp / ArrowDown | Moves one visual row using columns. |
Home / End | Moves to first or last month in current row. |
PageUp / PageDown | Moves one year. |
Shift + PageUp / Shift + PageDown | Moves ten years. |
Enter / Space | Selects focused month. |
Native buttons provide pointer and touch activation. Focus never scrolls the document unexpectedly.