Date Picker
Choose one available date from week, month, or year views.
Usage
Single
Keep one active value while moving and selecting with keyboard or pointer input.
Keep one active value while moving and selecting with keyboard or pointer input.
<!-- Date Picker / Single -->
<script setup lang="ts">
import { DatePickerRoot, DatePickerAnchor, DatePickerInput, DatePickerTrigger, DatePickerContent, DatePickerPreviousWeek, DatePickerPreviousMonth, DatePickerPreviousYear, DatePickerNextWeek, DatePickerNextMonth, DatePickerNextYear, DatePickerWeekViewTrigger, DatePickerMonthViewTrigger, DatePickerYearViewTrigger, DatePickerGrid, DatePickerCell, DatePickerMonthCell } from '@sectile/vue/date-picker'
import { CalendarDays } from '@lucide/vue'
const initialDate = { year: 2026, month: 8, day: 22 }
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
</script>
<template>
<DatePickerRoot :default-value="initialDate" v-slot="{ dates, months, view, viewMode }" class="catalog-stack catalog-temporal-picker">
<DatePickerAnchor class="catalog-inline">
<DatePickerInput class="catalog-input" />
<DatePickerTrigger class="catalog-picker-trigger" aria-label="Open date picker">
<CalendarDays :size="18" aria-hidden="true" />
</DatePickerTrigger>
</DatePickerAnchor>
<DatePickerContent class="catalog-popup catalog-picker-popup catalog-picker-popup--floating">
<div class="catalog-picker-toolbar">
<div class="catalog-inline">
<DatePickerPreviousWeek v-if="viewMode === 'week'">‹</DatePickerPreviousWeek>
<DatePickerPreviousMonth v-else-if="viewMode === 'month'">‹</DatePickerPreviousMonth>
<DatePickerPreviousYear v-else>‹</DatePickerPreviousYear>
<strong>{{ viewMode === 'year' ? view.year : monthNames[view.month - 1] + ' ' + view.year }}</strong>
<DatePickerNextWeek v-if="viewMode === 'week'">›</DatePickerNextWeek>
<DatePickerNextMonth v-else-if="viewMode === 'month'">›</DatePickerNextMonth>
<DatePickerNextYear v-else>›</DatePickerNextYear>
</div>
<div class="catalog-view-switch">
<DatePickerWeekViewTrigger>Week</DatePickerWeekViewTrigger>
<DatePickerMonthViewTrigger>Month</DatePickerMonthViewTrigger>
<DatePickerYearViewTrigger>Year</DatePickerYearViewTrigger>
</div>
</div>
<DatePickerGrid v-if="viewMode !== 'year'" class="catalog-calendar" :data-view="viewMode">
<DatePickerCell
v-for="day in dates.flat()"
:key="[day.year, day.month, day.day].join('-')"
:value="day"
>
{{ day.day }}
</DatePickerCell>
</DatePickerGrid>
<DatePickerGrid v-else class="catalog-month-grid">
<DatePickerMonthCell
v-for="month in months.flat()"
:key="[month.year, month.month].join('-')"
:value="month"
>
{{ monthNames[month.month - 1] }}
</DatePickerMonthCell>
</DatePickerGrid>
</DatePickerContent>
</DatePickerRoot>
</template>Weekdays
Keep every day visible while allowing only weekdays to be selected.
Keep every day visible while allowing only weekdays to be selected.
<!-- Date Picker / Weekdays -->
<script setup lang="ts">
import { DatePickerRoot, DatePickerAnchor, DatePickerInput, DatePickerTrigger, DatePickerContent, DatePickerPreviousWeek, DatePickerPreviousMonth, DatePickerPreviousYear, DatePickerNextWeek, DatePickerNextMonth, DatePickerNextYear, DatePickerWeekViewTrigger, DatePickerMonthViewTrigger, DatePickerYearViewTrigger, DatePickerGrid, DatePickerCell, DatePickerMonthCell } from '@sectile/vue/date-picker'
import { CalendarDays } from '@lucide/vue'
const initialDate = { year: 2026, month: 8, day: 22 }
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
</script>
<template>
<DatePickerRoot :default-value="initialDate" v-slot="{ dates, months, view, viewMode }" class="catalog-stack catalog-temporal-picker">
<DatePickerAnchor class="catalog-inline">
<DatePickerInput class="catalog-input" />
<DatePickerTrigger class="catalog-picker-trigger" aria-label="Open date picker">
<CalendarDays :size="18" aria-hidden="true" />
</DatePickerTrigger>
</DatePickerAnchor>
<DatePickerContent class="catalog-popup catalog-picker-popup catalog-picker-popup--floating">
<div class="catalog-picker-toolbar">
<div class="catalog-inline">
<DatePickerPreviousWeek v-if="viewMode === 'week'">‹</DatePickerPreviousWeek>
<DatePickerPreviousMonth v-else-if="viewMode === 'month'">‹</DatePickerPreviousMonth>
<DatePickerPreviousYear v-else>‹</DatePickerPreviousYear>
<strong>{{ viewMode === 'year' ? view.year : monthNames[view.month - 1] + ' ' + view.year }}</strong>
<DatePickerNextWeek v-if="viewMode === 'week'">›</DatePickerNextWeek>
<DatePickerNextMonth v-else-if="viewMode === 'month'">›</DatePickerNextMonth>
<DatePickerNextYear v-else>›</DatePickerNextYear>
</div>
<div class="catalog-view-switch">
<DatePickerWeekViewTrigger>Week</DatePickerWeekViewTrigger>
<DatePickerMonthViewTrigger>Month</DatePickerMonthViewTrigger>
<DatePickerYearViewTrigger>Year</DatePickerYearViewTrigger>
</div>
</div>
<DatePickerGrid v-if="viewMode !== 'year'" class="catalog-calendar" :data-view="viewMode">
<DatePickerCell
v-for="day in dates.flat()"
:key="[day.year, day.month, day.day].join('-')"
:value="day"
>
{{ day.day }}
</DatePickerCell>
</DatePickerGrid>
<DatePickerGrid v-else class="catalog-month-grid">
<DatePickerMonthCell
v-for="month in months.flat()"
:key="[month.year, month.month].join('-')"
:value="month"
>
{{ monthNames[month.month - 1] }}
</DatePickerMonthCell>
</DatePickerGrid>
</DatePickerContent>
</DatePickerRoot>
</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.
<!-- Date Picker / Controlled -->
<script setup lang="ts">
import { ref } from 'vue'
import { DatePickerRoot, DatePickerAnchor, DatePickerInput, DatePickerTrigger, DatePickerContent, DatePickerPreviousWeek, DatePickerPreviousMonth, DatePickerPreviousYear, DatePickerNextWeek, DatePickerNextMonth, DatePickerNextYear, DatePickerWeekViewTrigger, DatePickerMonthViewTrigger, DatePickerYearViewTrigger, DatePickerGrid, DatePickerCell, DatePickerMonthCell } from '@sectile/vue/date-picker'
import { CalendarDays } from '@lucide/vue'
const initialDate = { year: 2026, month: 8, day: 22 }
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
const value = ref(initialDate)
</script>
<template>
<DatePickerRoot v-model="value" v-slot="{ dates, months, view, viewMode }" class="catalog-stack catalog-temporal-picker">
<DatePickerAnchor class="catalog-inline">
<DatePickerInput class="catalog-input" />
<DatePickerTrigger class="catalog-picker-trigger" aria-label="Open date picker">
<CalendarDays :size="18" aria-hidden="true" />
</DatePickerTrigger>
</DatePickerAnchor>
<DatePickerContent class="catalog-popup catalog-picker-popup catalog-picker-popup--floating">
<div class="catalog-picker-toolbar">
<div class="catalog-inline">
<DatePickerPreviousWeek v-if="viewMode === 'week'">‹</DatePickerPreviousWeek>
<DatePickerPreviousMonth v-else-if="viewMode === 'month'">‹</DatePickerPreviousMonth>
<DatePickerPreviousYear v-else>‹</DatePickerPreviousYear>
<strong>{{ viewMode === 'year' ? view.year : monthNames[view.month - 1] + ' ' + view.year }}</strong>
<DatePickerNextWeek v-if="viewMode === 'week'">›</DatePickerNextWeek>
<DatePickerNextMonth v-else-if="viewMode === 'month'">›</DatePickerNextMonth>
<DatePickerNextYear v-else>›</DatePickerNextYear>
</div>
<div class="catalog-view-switch">
<DatePickerWeekViewTrigger>Week</DatePickerWeekViewTrigger>
<DatePickerMonthViewTrigger>Month</DatePickerMonthViewTrigger>
<DatePickerYearViewTrigger>Year</DatePickerYearViewTrigger>
</div>
</div>
<DatePickerGrid v-if="viewMode !== 'year'" class="catalog-calendar" :data-view="viewMode">
<DatePickerCell
v-for="day in dates.flat()"
:key="[day.year, day.month, day.day].join('-')"
:value="day"
>
{{ day.day }}
</DatePickerCell>
</DatePickerGrid>
<DatePickerGrid v-else class="catalog-month-grid">
<DatePickerMonthCell
v-for="month in months.flat()"
:key="[month.year, month.month].join('-')"
:value="month"
>
{{ monthNames[month.month - 1] }}
</DatePickerMonthCell>
</DatePickerGrid>
</DatePickerContent>
</DatePickerRoot>
</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/date-picker
DatePickerRootDatePickerTriggerDatePickerAnchorDatePickerPortalDatePickerContentDatePickerGridDatePickerCellDatePickerMonthCellDatePickerInputDatePickerPreviousWeekDatePickerNextWeekDatePickerPreviousMonthDatePickerNextMonthDatePickerPreviousYearDatePickerNextYearDatePickerWeekViewTriggerDatePickerMonthViewTriggerDatePickerYearViewTrigger
Props
DatePickerRootProps
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.
DatePickerPartProps
asElement or component rendered for this part.
asChildWhether to merge this part into its single child instead of rendering a wrapper.
DatePickerPortalProps
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
DatePickerRootSlotProps
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.
DatePickerCellSlotProps
disabledWhether interaction is unavailable.
highlightedWhether this item is highlighted for interaction.
inRangeWhether this value lies inside the selected range.
outsideMonthWhether this date belongs to an adjacent month.
selectedWhether this item is selected.
valueCurrent value exposed by this contract.
DatePickerMonthCellSlotProps
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
DatePickerValueChangeHandler
type DatePickerValueChangeHandler = NonNullable<InstanceType<typeof DatePickerRoot>['$props']['onUpdate:modelValue']>DatePickerOpenChangeHandler
type DatePickerOpenChangeHandler = NonNullable<InstanceType<typeof DatePickerRoot>['$props']['onUpdate:open']>DatePickerHighlightedValueChangeHandler
type DatePickerHighlightedValueChangeHandler = NonNullable<InstanceType<typeof DatePickerRoot>['$props']['onUpdate:highlightedValue']>DateValue
| Name | Type | Required |
|---|---|---|
year | number | Yes |
month | number | Yes |
day | number | Yes |
Parts
Shared scope: [data-scope="date-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. | — |
week-view-trigger | [data-part="week-view-trigger"] | Switches the calendar to the week view. | — |
month-view-trigger | [data-part="month-view-trigger"] | Switches the calendar to the month view. | — |
year-view-trigger | [data-part="year-view-trigger"] | Switches the calendar to the year view. | — |
previous-week | [data-part="previous-week"] | Moves to the previous week. | — |
next-week | [data-part="next-week"] | Moves to the next week. | — |
previous-month | [data-part="previous-month"] | Moves to the previous month. | — |
next-month | [data-part="next-month"] | Moves to the next month. | — |
previous-year | [data-part="previous-year"] | Moves to the previous year. | — |
next-year | [data-part="next-year"] | Moves to the next year. | — |
grid | [data-part="grid"] | Groups cells into a navigable two-dimensional structure. | — |
cell | [data-part="cell"] | Represents one navigable or selectable grid value. | — |
month-cell | [data-part="month-cell"] | Represents one selectable month. | — |
Keyboard interaction
| Key | Behavior |
|---|---|
| Arrow keys | Move the highlighted date by one day or one week. |
| Home / End | Move to the start or end of the week. |
| Page Up / Page Down | Move by one month; hold Shift to move by one year. |
| Enter / Space | Select the highlighted date. |
| Escape | Close the calendar without selecting another date. |
Accessibility
The labeled input and trigger own a calendar grid whose cells expose selected, highlighted, and disabled state.
See the corresponding WAI-ARIA pattern for the host accessibility contract.
