Skip to main content
Vuetify0 Logo
Theme
Mode
Palettes
Accessibility
Vuetify One
Sign in to Vuetify One

Access premium tools across the Vuetify ecosystem — Bin, Play, Studio, and more.

Not a subscriber? See what's included

createCalendar API

Gregorian month grid with single and range selection. Days outside min and max are disabled, and a list or a predicate can disable individual days.

Explore these related pages for additional context and usage patterns.

PageCategory
createCalendarForms
useDatePlugins
createInputForms

Functions

createCalendar

(options?: CalendarOptions<Z>) => CalendarContext

Options

adapter

DateAdapter<Z> | undefined

Date engine. Omit it to borrow an installed date plugin, or to use V0PlainDateAdapter when none is installed. An adapter you pass is not replaced, and its firstDayOfWeek is not written.

namespace

string | undefined

Namespace of an installed date plugin.

Default: 'v0:date'

month

MaybeRefOrGetter<string | undefined>

Visible month. YYYY-MM, or a day whose month is used. Omitted means the current month, clamped to min and max. A writable ref is written as YYYY-MM when the grid pages. Inside a component it is also written when min or max clamps the month it opened on. A day token stays while the page stays in that month. A getter or a readonly ref is not written.

value

MaybeRefOrGetter<CalendarValue>

Selected day, or { start, end } in range mode. A ref is written back. A getter or a readonly ref is not. Inside a component, changing mode clears it.

mode

MaybeRefOrGetter<CalendarMode> | undefined

'single' selects one day. 'range' selects a start and an end. A ref or getter is read on each interaction. Inside a component, changing it clears the selection.

Default: 'single'

min

MaybeRefOrGetter<string | undefined>

YYYY-MM-DD. Days before it are disabled.

max

MaybeRefOrGetter<string | undefined>

YYYY-MM-DD. Days after it are disabled.

disabled

MaybeRefOrGetter<CalendarDisabled> | undefined

true disables every day. An array of YYYY-MM-DD days disables those days. A function disables the days it returns true for. A bare function is the predicate and is called with the ISO day, not passed through toValue. Navigation still runs.

Default: false

readonly

MaybeRefOrGetter<boolean> | undefined

select and unselect no-op. Cells stay enabled, and paging still runs.

Default: false

firstDayOfWeek

MaybeRefOrGetter<number | undefined>

Week start. 0 is Sunday. A finite number wins and is not written onto the adapter. Omit it to follow the adapter, or an owned locale.

fixedWeeks

MaybeRefOrGetter<boolean> | undefined

Pad the grid to six rows.

Default: false

mandatory

MaybeRefOrGetter<boolean> | undefined

In single mode, clicking the selected day again does not clear it. Another day still replaces it. unselect() no-ops. Range clicks ignore this. Nothing is selected until the caller selects a day.

Default: false

locale

MaybeRefOrGetter<string | undefined>

BCP 47 tag. Written onto the adapter only when this call constructs it, which moves the weekday columns and the month label. A borrowed adapter keeps its own locale.

weekdayFormat

CalendarWeekdayFormat | undefined

Weekday column labels.

Default: 'narrow'

Properties

month

ComputedRef<CalendarMonth>

The visible month. One object, not an array.

weekdays

ComputedRef<string[]>

Seven labels, rotated to the week start.

label

ComputedRef<string>

Localized month and year. Year 0 follows Intl, which numbers that year 1.

anchor

Readonly<Ref<string, string>>

YYYY-MM.

focused

Readonly<Ref<string, string>>

YYYY-MM-DD navigation follows. May sit on a disabled in-month day.

value

Readonly<Ref<CalendarValue, CalendarValue>>

ISO day, or { start, end } in range mode.

isFirst

Readonly<Ref<boolean, boolean>>

At the min month, or the first representable month.

isLast

Readonly<Ref<boolean, boolean>>

At the max month, or the last representable month.

Methods

select

(iso: string) => void

Selects an in-month day that is not disabled. In single mode, a second click on that day clears it, unless mandatory is set. In range mode, a later click sets the end or starts a new range.

unselect

() => void

Clears the selection. No-ops when mandatory or readonly is set.

today

() => void

Pages to the current month and focuses today. Selects nothing.

selectToday

() => void

Focuses today and selects it when that day is allowed.

next

() => void

Page to the next month, clamped to max.

prev

() => void

Page to the previous month, clamped to min.

step

(count: number) => void

Page by whole months, clamped to min and max.

goto

(value: string) => void

YYYY-MM or YYYY-MM-DD. Pages and focuses.

move

(unit: CalendarUnit, amount: number) => void

Walks the focused day and pages when it leaves the month. A step past min or max lands on that wall.

first

() => void

Page to the min month. No-op when min is unset.

last

() => void

Page to the max month. No-op when max is unset.

Was this page helpful?

© 2016-1970 Vuetify, LLC
Services
Ctrl+/