Date picker
VDatePicker is an inline calendar for a date, a range or several dates. Values are local dates in YYYY-MM-DD format.
Usage
<script setup lang="ts">
import { ref } from 'vue'
import { VDatePicker } from 'vectis-ui'
const date = ref('2026-06-10')
</script>
<template>
<VDatePicker v-model="date" />
</template>Examples
Range
Select the start and end of the range in two steps. The model is { start, end }; either bound can be null while the range is incomplete.
<script setup lang="ts">
import { ref } from 'vue'
import { VDatePicker, type DatePickerRange } from 'vectis-ui'
const period = ref<DatePickerRange>({ start: '2026-06-19', end: '2026-06-26' })
</script>
<template>
<div class="column">
<VDatePicker v-model="period" selection="range" />
<output class="value" aria-label="Chosen period">
{{ period.start ?? 'none' }} to {{ period.end ?? 'none' }}
</output>
</div>
</template>
<style scoped>
.column {
display: grid;
justify-items: start;
gap: var(--vectis-space-3);
}
.value {
font-family: var(--vectis-text-family-code);
font-size: var(--vectis-text-body-sm-size);
color: var(--vectis-color-text-muted);
}
</style>Multiple dates
Select dates to add them to the ISO date array; select them again to remove them.
<script setup lang="ts">
import { ref } from 'vue'
import { VDatePicker } from 'vectis-ui'
const dates = ref<string[]>(['2026-06-05', '2026-06-12', '2026-06-19'])
</script>
<template>
<div class="column">
<VDatePicker v-model="dates" selection="multiple" />
<output class="value" aria-label="Chosen dates">{{ dates.join(', ') || 'none' }}</output>
</div>
</template>
<style scoped>
.column {
display: grid;
justify-items: start;
gap: var(--vectis-space-3);
}
.value {
font-family: var(--vectis-text-family-code);
font-size: var(--vectis-text-body-sm-size);
color: var(--vectis-color-text-muted);
}
</style>Presets
Place preset date buttons in footer and update the model from them.
<script setup lang="ts">
import { ref } from 'vue'
import { VButton, VDatePicker } from 'vectis-ui'
const date = ref('2026-06-10')
/* Read today's local date in the click handler to avoid a prerendered value. */
function inDays(offset: number) {
const day = new Date()
day.setDate(day.getDate() + offset)
const month = String(day.getMonth() + 1).padStart(2, '0')
date.value = `${day.getFullYear()}-${month}-${String(day.getDate()).padStart(2, '0')}`
}
</script>
<template>
<VDatePicker v-model="date">
<template #footer>
<VButton variant="ghost" tone="neutral" size="sm" @click="inDays(0)">Today</VButton>
<VButton variant="ghost" tone="neutral" size="sm" @click="inDays(1)">Tomorrow</VButton>
<VButton variant="ghost" tone="neutral" size="sm" @click="inDays(7)">In a week</VButton>
</template>
</VDatePicker>
</template>Disabled dates
disabledDates accepts ISO dates or a predicate. Unavailable days remain visible and reachable with the keyboard.
<script setup lang="ts">
import { ref } from 'vue'
import { VDatePicker, VTypography } from 'vectis-ui'
const appointment = ref('2026-06-16')
const holiday = ref('2026-06-16')
function isWeekend(iso: string) {
const day = new Date(`${iso}T00:00:00`).getDay()
return day === 0 || day === 6
}
const closedDays = ['2026-06-11', '2026-06-12', '2026-06-25']
</script>
<template>
<div class="row">
<div class="group">
<VTypography variant="overline" tone="muted">a predicate</VTypography>
<VDatePicker v-model="appointment" :disabled-dates="isWeekend" />
</div>
<div class="group">
<VTypography variant="overline" tone="muted">a list</VTypography>
<VDatePicker v-model="holiday" :disabled-dates="closedDays" />
</div>
</div>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: var(--vectis-space-6);
}
.group {
display: grid;
gap: var(--vectis-space-2);
}
</style>Minimum and maximum
min and max restrict both selection and calendar navigation.
<script setup lang="ts">
import { ref } from 'vue'
import { VDatePicker } from 'vectis-ui'
const date = ref('2026-06-15')
</script>
<template>
<VDatePicker v-model="date" min="2026-06-05" max="2026-06-24" />
</template>Event dots
Mark events with coloured dots. Their labels are included in the day’s accessible name.
MonTueWedThuFriSatSun
<script setup lang="ts">
import { ref } from 'vue'
import { VDatePicker, type DatePickerEvent } from 'vectis-ui'
const date = ref('2026-06-10')
const events: DatePickerEvent[] = [
{ date: '2026-06-10', label: 'Kick-off' },
{ date: '2026-06-18', color: 'var(--vectis-color-danger)', label: 'Deadline' },
{ date: '2026-06-18', color: 'var(--vectis-color-warning)', label: 'Review' },
{ date: '2026-06-24', color: 'var(--vectis-color-success)', label: 'Release' },
]
</script>
<template>
<VDatePicker v-model="date" :events="events" />
</template>Adjacent days
Show neighbouring days with showAdjacentDays. Enable their selection with selectAdjacentDays.
<script setup lang="ts">
import { ref } from 'vue'
import { VDatePicker, VTypography } from 'vectis-ui'
const hidden = ref('2026-06-10')
const shown = ref('2026-06-10')
const selectable = ref('2026-06-10')
</script>
<template>
<div class="row">
<div class="group">
<VTypography variant="overline" tone="muted">hidden, the default</VTypography>
<VDatePicker v-model="hidden" />
</div>
<div class="group">
<VTypography variant="overline" tone="muted">shown</VTypography>
<VDatePicker v-model="shown" show-adjacent-days />
</div>
<div class="group">
<VTypography variant="overline" tone="muted">shown and choosable</VTypography>
<VDatePicker v-model="selectable" select-adjacent-days />
</div>
</div>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: var(--vectis-space-6);
}
.group {
display: grid;
gap: var(--vectis-space-2);
}
</style>Localization
locale sets month names and week start. firstDayOfWeek overrides the week start.
fr-FR, weeks from Mondaylun.mar.mer.jeu.ven.sam.dim.
en-US, weeks forced to Monday <script setup lang="ts">
import { ref } from 'vue'
import { VDatePicker, VTypography } from 'vectis-ui'
const locales = ref([
{ tag: 'en-US', caption: 'en-US, weeks from Sunday', date: '2026-06-10' },
{ tag: 'fr-FR', caption: 'fr-FR, weeks from Monday', date: '2026-06-10' },
{ tag: 'ja-JP', caption: 'ja-JP', date: '2026-06-10' },
])
const forced = ref('2026-06-10')
</script>
<template>
<div class="row">
<div v-for="locale in locales" :key="locale.tag" class="group">
<VTypography variant="overline" tone="muted">{{ locale.caption }}</VTypography>
<VDatePicker v-model="locale.date" :locale="locale.tag" />
</div>
<div class="group">
<VTypography variant="overline" tone="muted">en-US, weeks forced to Monday</VTypography>
<VDatePicker v-model="forced" locale="en-US" :first-day-of-week="1" />
</div>
</div>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: var(--vectis-space-6);
}
.group {
display: grid;
gap: var(--vectis-space-2);
}
</style>API
Props
Events
Slots
Types
Types used in the API tables. Import exported types from vectis-ui.
export interface DatePickerDaySlotProps {
iso: string
day: number
inMonth: boolean
disabled: boolean
selected: boolean
today: boolean
inRange: boolean
events: DatePickerEvent[]
}export interface DatePickerEvent {
date: string
color?: string
label?: string
}export type DatePickerMatcher = string[] | ((iso: string) => boolean)
export interface DatePickerRange {
start: string | null
end: string | null
}export type DatePickerValue = string | null | DatePickerRange | string[]
CSS variables