Calendar
Select dates from a calendar with keyboard navigation.
Demos
Size
October 2026
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 Calendar.vue and index.ts into app/components/ui/calendar/.
app/components/ui/calendar/Calendar.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[] | CalendarDateRange | undefined | undefined | Selected single date, independent dates, or { start, end } range according to selectionMode. |
v-model:placeholder | CalendarDateValue | selected date or today | Month used as the start of the visible view. |
See Range selection for preview fills and primary-colored endpoints.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
rangeColor | "secondary" | "accent" | "secondary" | Preview and committed middle fill; endpoints use primary. |
locale | string | "en-US" | Locale used for labels and week calculations. |
dir | "ltr" | "rtl" | "ltr" | Reading direction and horizontal arrow behavior. |
calendarLabel | string | "Calendar" | Accessible root label prefix. |
weekStartsOn | "sun" | "mon" | ... | locale default | Explicit first day of week. |
weekdayFormat | "narrow" | "short" | "long" | "narrow" | Visible weekday label format. |
fixedWeeks | boolean | false | Always renders six weeks per month. |
numberOfMonths | number | 1 | Adjacent month grids to render. |
pagedNavigation | boolean | false | Navigates by numberOfMonths instead of one month. |
preventDeselect | boolean | false | Prevents removing an already selected date. |
selectionMode | "single" | "multiple" | "range" | "single" | Selects model shape and interaction behavior. |
multiple | boolean | false | Deprecated compatibility alias for selectionMode="multiple". |
allowNonContiguousRanges | boolean | false | Allows unavailable or disabled dates inside a range, but not at either endpoint. |
maximumDays | number | — | Maximum inclusive length accepted in range mode. |
fixedDate | "start" | "end" | — | Keeps one boundary fixed while range interactions update only the opposite boundary. |
disabled | boolean | false | Disables navigation and selection. |
readOnly | boolean | false | Allows focus/navigation but blocks selection. |
initialFocus | boolean | false | Focuses the roving day after mount. |
disableDaysOutsideCurrentView | boolean | false | Prevents selecting outside days. |
minValue | CalendarDateValue | — | Earliest selectable date and navigation boundary. |
maxValue | CalendarDateValue | — | Latest selectable date and navigation boundary. |
isDateDisabled | (date) => boolean | — | Marks dates disabled by application rules. |
isDateUnavailable | (date) => boolean | — | Marks dates unavailable and invalid when externally selected. |
nextPage | (placeholder) => CalendarDateValue | add month(s) | Custom next-page calculation. |
prevPage | (placeholder) => CalendarDateValue | subtract month(s) | Custom previous-page calculation. |
ui | CalendarUi | — | Classes for generated structural parts. |
Slots
| Slot | Props | Description |
|---|---|---|
previous | disabled | Previous control content. |
heading | label, months | Current month or range heading. |
next | disabled | Next control content. |
weekday | date, label | Weekday heading content. |
day | date, label, selected, rangeStart, rangeEnd, inRange, highlighted, today, outside, disabled, unavailable, focused | Day button content and complete selection state. |
footer | value, placeholder | Optional content after grids. |
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue | value | Fired after accepted selection changes. |
update:placeholder | date | Fired after accepted visible-month changes. |
value-change | (value, details) | Fires before selection changes. details.cancel() prevents update. |
placeholder-change | (date, details) | Fires before page changes. details.cancel() prevents update. |
Keyboard
| Key | Behavior |
|---|---|
ArrowLeft / ArrowRight | Move one day, direction-aware in RTL. |
ArrowUp / ArrowDown | Move one week. |
Home / End | Move to start/end of current week. |
PageUp / PageDown | Move one month. |
Shift + PageUp / Shift + PageDown | Move one year. |
Enter / Space | Select or deselect focused date. |
Only one day is in the Tab sequence. Arrow navigation can cross month boundaries and updates v-model:placeholder before moving focus.