Skip to content

shadcn.io is an independent project built on shadcn/ui

Components

Free

Date Picker for Vue UI SDK

A button or typed field that opens a month in a popover, for one date or a range, for Vue on UI SDK, with year menus and a time field.

On this page9 sections

A date picker is a form field for a date: a button, or a text input, that opens a month in a popover and closes once a day is picked, leaving the date written in the field. Use it when the date is one entry among others, as in a booking form or a profile.

When choosing the date is the main task and the month should stay in view, use a Calendar. For a date typed segment by segment with no popover at all, use a Date Input.

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Anatomy

Date Picker anatomy: content, prev trigger, next trigger, table cell, trigger, value

Usage

<script setup lang="ts">
import { ChevronDownIcon } from "lucide-vue-next"
import { Button } from "@/components/ui/button"
import {
  CalendarNextTrigger, CalendarPrevTrigger, CalendarTable,
  CalendarTableDays, CalendarViewControl, CalendarViewDate,
  CalendarWeekDays,
} from "@/components/ui/calendar"
import {
  DatePicker, DatePickerContent, DatePickerTrigger, DatePickerValue,
} from "@/components/ui/date-picker"
</script>

<template>
  <DatePicker>
    <DatePickerTrigger>
      <template #render="{ props }">
        <Button v-bind="props" class="w-[212px] justify-between font-normal" variant="outline">
          <DatePickerValue placeholder="Pick a date" />
          <ChevronDownIcon aria-hidden="true" data-icon="inline-end" />
        </Button>
      </template>
    </DatePickerTrigger>
    <DatePickerContent>
      <CalendarViewControl>
        <CalendarPrevTrigger />
        <CalendarViewDate />
        <CalendarNextTrigger />
      </CalendarViewControl>
      <CalendarTable><CalendarWeekDays /><CalendarTableDays /></CalendarTable>
    </DatePickerContent>
  </DatePicker>
</template>

Accessibility

The trigger is a button with aria-haspopup="dialog" that reports aria-expanded, and opening moves focus into the dialog's grid, onto the selected day, or today when nothing is picked. Each day is named by its full date, weekday included. On its own the trigger is named Choose date, followed by the picked date once there is one. Pass the field label's id to DatePickerTrigger as aria-labelledby, as the Basic demo does, and the label and what DatePickerValue shows name it instead. Inside a Field, the FieldLabel names it the same way with no id to pass, and pressing the label opens the picker. Picking a day or pressing Escape sends focus back to the trigger.

Enter
On the trigger, opens the calendar. On a day, selects it and closes the calendar, or in a range waits for the second day. In the input, commits the typed date.
Space
On the trigger, opens the calendar. On a day, selects it as a click does.
Arrow Left
Moves focus to the previous day, into the previous week or month when it has to.
Arrow Right
Moves focus to the next day, into the next week or month when it has to.
Arrow Up
Moves focus to the same day of the week in the previous week.
Arrow Down
Moves focus to the same day of the week in the next week.
Home
Moves focus to the first day of the week.
End
Moves focus to the last day of the week.
Page Up
Moves focus to the same day of the month in the previous month.
Page Down
Moves focus to the same day of the month in the next month.
Shift+Page Up
Moves focus to the same day in the previous year.
Shift+Page Down
Moves focus to the same day in the next year.
Alt+Arrow Down
In the input, opens the calendar on the typed date's month.
Escape
In a range with only its start picked, cancels that pick. Otherwise closes the calendar without changing the date.

The month and year views, a DatePickerView with view set to month or year, are grids too, with one tab stop. The arrow keys move a month or a year at a time, mirrored right to left, Home and End go to the first and last month of the year or year of the decade, and PageUp and PageDown move a year or a decade. Enter or Space picks the focused one.

Demos

Basic

A button under a Date label that reads Pick a date until a day is chosen, then shows it as month, day and year in digits. The popover holds one month with previous and next buttons, and the click that picks a day closes it. Use this shape for a date close to today in a form, such as a delivery or a start date.

Preview width

Range

Two months open side by side, with January 20 of this year to 20 days later already selected, so the button shows both dates with a hyphen between them. The next click starts a new range, and the one after it ends the range and closes the popover. Opening it puts keyboard focus on January 20, the start of the range.

Preview width

Disabled dates

Weekends, the 3rd through the 7th of this month and the 22nd can't be picked: isDateUnavailable returns true for each, and they stay in the grid with a line through the number. The button shows the picked date in long form, written by the demo itself. Add min set to today when the past should close as well.

Preview width

DOB

A date of birth field with month and year menus between the arrows. With no min or max, the year menu lists ten years either side of the year shown, so going decades back takes a few picks. open and value are held in state, and picking a day closes the popover. For a real birth date, set min and max, and the year menu runs between their years.

Preview width

Input

A text field under a Subscription Date label, starting at June 1, 2025, with a calendar button at its end. People type digits in the locale's order, 06/01/2025 in US English, and Enter or leaving the field commits the date. Emptied, it stays blank unless you pass placeholder. The label points at an id passed to DatePickerInput, since the picker otherwise gives the input an id of its own.

Preview width

Time

A Date button and a Time field side by side. The time is a DatePickerTimer, a native time input with seconds that starts at 10:30:00, and the date popover has month and year menus. The two values stay separate until you join them when you save, as for an appointment that needs a day and an hour.

Preview width

Natural language

A text field that starts with In 2 days filled in and understands today, tomorrow, next week and in a number of days, plus any string Date.parse reads. A phrase it understands sets the date as you type, and the line underneath spells it out. ArrowDown or the calendar button opens the month. The parsing is the demo's own code, in English, so write your own for other phrases.

Preview width

RTL

The picker in Arabic, inside a LocaleProvider with the ar locale, so the placeholder, the weekday names and the grid read right to left, and ArrowLeft moves to the next day. The provider wraps the picker in an element with lang and dir set, and the popover, which renders at the end of the page, still takes both from it. Use it to check a form in Arabic or Hebrew.

Preview width

FAQ

How do I get the selected date from the Date Picker in Vue?

Bind a ref with v-model:value, or listen to @value-change, which receives the value first and the details second. One date is a DateValue, or null before a day is picked, a range is a two-item array and selectionMode set to multiple gives an array.

On UI SDK a DateValue is this component's own object, with no date library behind it, and parseDate from the same file makes one. Call toString() on it for an ISO string such as 2026-11-11, or toDate() for a JavaScript Date.

How do I select a date range with the Date Picker?

Set selectionMode to range. The first click sets the start, the second sets the end and closes the popover, and the value holds the two dates in order. Set numOfMonths to 2 and put DatePickerTableNextMonth in a second table to show two months side by side, as the Range demo does.

Give DatePickerValue a separator, such as a hyphen with spaces, for the text on the button. For separate dates instead, set selectionMode to multiple, and the popover stays open while people click.

How do I disable past dates or weekends in the Date Picker?

Set min to today, made with parseDate(new Date()) from this component, and the days before it fade, can't be picked, and Previous stops at that month. max does the same for days after a date.

For weekends, holidays or booked days, pass isDateUnavailable, which gets each date and the locale and returns true for a day to block, as the Disabled dates demo does. Blocked days stay in the grid, and Enter does nothing on them.

How do I make a birthday Date Picker that jumps to a year?

Put DatePickerMonthSelect and DatePickerYearSelect between the arrows, as the DOB demo does, so 1984 is one choice in a list instead of hundreds of clicks back. Without min or max, the year list holds ten years either side of the year shown.

Set max to today, which disables the future days and ends the year list at this year, and min to the earliest date that makes sense for your form, whose year then opens the list.

Can users type a date in the Date Picker instead of clicking?

Yes, use DatePickerInput in place of the trigger button, as the Input demo does, and the calendar opens from the button at its end. The field takes digits and the separator in the locale's order, such as 06/01/2025 in US English, and commits the date on Enter or when it loses focus. Give it an id for the field's label to point at, since the picker sets an id of its own.

For phrases such as tomorrow or in 3 days, the Natural language demo parses the text itself and keeps a calendar for clicking.

How do I pick a date and a time with the Date Picker?

Put a DatePickerTimer next to the picker, as the Time demo does. It is a native time input with seconds, and its value stays apart from the date, so join the two when you save, from the date's year, month and day and the time's hours and minutes.

For a date and time typed into one field, segment by segment, use a Date Input with granularity set to minute.

How do I change the Date Picker language and the first day of the week?

Set locale, such as fr-FR or de-DE, and the month and weekday names, the date on the button and the input's format all follow it. Set startOfWeek to a number from 0 for Sunday to 6 for Saturday to choose the first column, or leave it out and the locale decides.

The direction doesn't follow locale. For Arabic or Hebrew, wrap the picker in a LocaleProvider with that locale, which sets the language and the direction on an element around it, as the RTL demo does. The popover renders at the end of the page but takes the direction from that element, so the grid runs right to left, with ArrowLeft moving to the next day.

Why does the Date Picker open above the field?

This component passes positioning with placement set to top unless you pass your own, so the popover opens upward and flips below only when there isn't room above. Pass positioning with placement set to bottom-start to open it under the field, lined up with its start edge.

The same object takes gutter, the gap between the field and the popover in pixels, which is 8 by default.

API Reference

DatePicker

PropType
open?boolean

Whether it's open. Pair with onOpenChange to control it. Two-way with v-model:open.

defaultOpen?boolean

Whether it starts open, when you don't control open.

value?DateValue[]

The value. Pair with onValueChange to control it. Two-way with v-model.

defaultValue?DateValue[]

The value it starts with, when you don't control value.

closeOnSelect?boolean

Closes the calendar once a date, a range's end, or a preset is picked.

Default
true
defaultFocusedValue?object

Turns the calendar to this date's month when it opens first.

Type
{ add: (duration: DateDuration) → DateValue; compare: (other: { day: number; month: number; year: number }) → number; day: number; month: number; set: (fields: { day?: number; month?: number; year?: number }) → DateValue; subtract: (duration: DateDuration) → DateValue; toDate: (timeZone?: string) → Date; toString: () → string; year: number }
disabled?boolean

Whether it's disabled.

fixedWeeks?boolean

Shows six weeks in every month.

focusedValue?object

Turns the calendar to this date's month.

Type
{ add: (duration: DateDuration) → DateValue; compare: (other: { day: number; month: number; year: number }) → number; day: number; month: number; set: (fields: { day?: number; month?: number; year?: number }) → DateValue; subtract: (duration: DateDuration) → DateValue; toDate: (timeZone?: string) → Date; toString: () → string; year: number }
ids?{ content?: string; input?: string; label?: string; trigger?: string }

Ids for the parts: trigger, input, content, label.

Type
{ content?: string; input?: string; label?: string; trigger?: string }
invalid?boolean

Marks the field invalid, as a form library reports it.

isDateUnavailable?(date: DateValue, locale: string) → boolean

Dates that can't be picked. They stay focusable, so keyboard users hear them.

Type
(date: DateValue, locale: string) → boolean
Parameters

date – { add: (duration: DateDuration) → DateValue; compare: (other: { day: number; month: number; year: number }) → number; day: number; month: number; set: (fields: { day?: number; month?: number; year?: number }) → DateValue; subtract: (duration: DateDuration) → DateValue; toDate: (timeZone?: string) → Date; toString: () → string; year: number }

locale – string

Returns
boolean
lazyMount?boolean

Kept for the other bases: the popup always mounts when it opens.

Default
false
locale?string

The language of names, labels and typed dates. Defaults to the page's.

Default
"en-US"
max?object

The highest value.

Type
{ add: (duration: DateDuration) → DateValue; compare: (other: { day: number; month: number; year: number }) → number; day: number; month: number; set: (fields: { day?: number; month?: number; year?: number }) → DateValue; subtract: (duration: DateDuration) → DateValue; toDate: (timeZone?: string) → Date; toString: () → string; year: number }
maxSelectedDates?number

The most dates selectionMode="multiple" keeps.

min?object

The lowest value.

Type
{ add: (duration: DateDuration) → DateValue; compare: (other: { day: number; month: number; year: number }) → number; day: number; month: number; set: (fields: { day?: number; month?: number; year?: number }) → DateValue; subtract: (duration: DateDuration) → DateValue; toDate: (timeZone?: string) → Date; toString: () → string; year: number }
name?string

The name the ISO date submits under.

numOfMonths?number

How many months show side by side.

placeholder?string

The input's placeholder.

positioning?object

Where the calendar opens: Ark's placement, gutter and offset.

Type
{ gutter?: number; offset?: { crossAxis?: number; mainAxis?: number }; placement?: Placement }
readOnly?boolean

Whether the calendar is read-only.

required?boolean

Whether a value is required to submit its form.

selectionMode?SelectionMode

One date, several, or a range.

Default
"single"
showWeekNumbers?boolean

Shows the week number at the start of each week.

startOfWeek?number

The first day of the week, 0 for Sunday. Defaults to the locale's.

timeZone?string

The time zone that says which day today is.

Default
"UTC"
unmountOnExit?boolean

Keeps the popup in the page while closed when false.

Default
false
EventType
@open-change(details: { open: boolean }) → void

Called when it opens or closes.

Type
(details: { open: boolean }) → void
Parameters

details – { open: boolean }

Returns
void
@value-change(details: { value: DateValue[]; valueAsString: string[]; view: DatePickerView; }) → void

Called when the value changes.

Type
(details: { value: DateValue[]; valueAsString: string[]; view: DatePickerView; }) → void
Parameters

details – { value: DateValue[]; valueAsString: string[]; view: DatePickerView; }

Returns
void
@focus-change(details: { focusedValue: DateValue }) → void

Function called when the focused date changes.

Type
(details: { focusedValue: DateValue }) → void
Parameters

details – { focusedValue: DateValue }

Returns
void

DatePickerRootProvider

PropType
open?boolean

Whether it's open. Pair with onOpenChange to control it. Two-way with v-model:open.

defaultOpen?boolean

Whether it starts open, when you don't control open.

valueDatePickerController

What useDatePicker() returns: the state and API, made outside the component to control it. Two-way with v-model.

defaultValue?DateValue[]

The value it starts with, when you don't control value.

closeOnSelect?boolean

Closes the calendar once a date, a range's end, or a preset is picked.

defaultFocusedValue?object

Turns the calendar to this date's month when it opens first.

Type
{ add: (duration: DateDuration) → DateValue; compare: (other: { day: number; month: number; year: number }) → number; day: number; month: number; set: (fields: { day?: number; month?: number; year?: number }) → DateValue; subtract: (duration: DateDuration) → DateValue; toDate: (timeZone?: string) → Date; toString: () → string; year: number }
disabled?boolean

Whether the root provider is disabled.

fixedWeeks?boolean

Shows six weeks in every month.

focusedValue?object

Turns the calendar to this date's month.

Type
{ add: (duration: DateDuration) → DateValue; compare: (other: { day: number; month: number; year: number }) → number; day: number; month: number; set: (fields: { day?: number; month?: number; year?: number }) → DateValue; subtract: (duration: DateDuration) → DateValue; toDate: (timeZone?: string) → Date; toString: () → string; year: number }
ids?{ content?: string; input?: string; label?: string; trigger?: string }

Ids for the parts: trigger, input, content, label.

Type
{ content?: string; input?: string; label?: string; trigger?: string }
invalid?boolean

Marks the field invalid, as a form library reports it.

isDateUnavailable?(date: DateValue, locale: string) → boolean

Dates that can't be picked. They stay focusable, so keyboard users hear them.

Type
(date: DateValue, locale: string) → boolean
Parameters

date – { add: (duration: DateDuration) → DateValue; compare: (other: { day: number; month: number; year: number }) → number; day: number; month: number; set: (fields: { day?: number; month?: number; year?: number }) → DateValue; subtract: (duration: DateDuration) → DateValue; toDate: (timeZone?: string) → Date; toString: () → string; year: number }

locale – string

Returns
boolean
lazyMount?boolean

Kept for the other bases: the popup always mounts when it opens.

Default
false
locale?string

The language of names, labels and typed dates. Defaults to the page's.

max?object

The highest value.

Type
{ add: (duration: DateDuration) → DateValue; compare: (other: { day: number; month: number; year: number }) → number; day: number; month: number; set: (fields: { day?: number; month?: number; year?: number }) → DateValue; subtract: (duration: DateDuration) → DateValue; toDate: (timeZone?: string) → Date; toString: () → string; year: number }
maxSelectedDates?number

The most dates selectionMode="multiple" keeps.

min?object

The lowest value.

Type
{ add: (duration: DateDuration) → DateValue; compare: (other: { day: number; month: number; year: number }) → number; day: number; month: number; set: (fields: { day?: number; month?: number; year?: number }) → DateValue; subtract: (duration: DateDuration) → DateValue; toDate: (timeZone?: string) → Date; toString: () → string; year: number }
name?string

The name the ISO date submits under.

numOfMonths?number

How many months show side by side.

placeholder?string

The input's placeholder.

positioning?object

Where the calendar opens: Ark's placement, gutter and offset.

Type
{ gutter?: number; offset?: { crossAxis?: number; mainAxis?: number }; placement?: Placement }
readOnly?boolean
required?boolean

Whether a value is required to submit its form.

selectionMode?SelectionMode

One date, several, or a range.

showWeekNumbers?boolean

Shows the week number at the start of each week.

startOfWeek?number

The first day of the week, 0 for Sunday. Defaults to the locale's.

timeZone?string

The time zone that says which day today is.

unmountOnExit?boolean

Keeps the popup in the page while closed when false.

Default
false
EventType
@open-change(details: { open: boolean }) → void

Called when it opens or closes.

Type
(details: { open: boolean }) → void
Parameters

details – { open: boolean }

Returns
void
@value-change(details: { value: DateValue[]; valueAsString: string[]; view: DatePickerView; }) → void

Called when the value changes.

Type
(details: { value: DateValue[]; valueAsString: string[]; view: DatePickerView; }) → void
Parameters

details – { value: DateValue[]; valueAsString: string[]; view: DatePickerView; }

Returns
void
@focus-change(details: { focusedValue: DateValue }) → void
Type
(details: { focusedValue: DateValue }) → void
Parameters

details – { focusedValue: DateValue }

Returns
void

DatePickerTrigger

<div> data-slot="date-picker-control"

PropType
#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

AttributeType
data-closed?string

Present while the popup is closed, including while it animates out.

data-disabled?string

Present when the date picker is disabled.

data-open?string

Present while the popup is open.

DatePickerInput

<div> data-slot="date-picker-control"

PropType
index?number

Which end of a range it holds: 0 for the start, 1 for the end.

Default
0
size?DatePickerInputSize

The size of the input.

Default
"md"
#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

AttributeType
data-disabled?string

Present when the date picker is disabled.

data-invalid?string

Present when an input holds text that isn't a date, or a date that can't be picked.

data-size"icon-xs"
Default
"icon-xs"
data-variant"ghost"
Default
"ghost"

DatePickerTimer

PropType
value?string | number

The value, for a controlled field. A number is written as its text, as a native input does. Two-way with v-model.

Type
string | number
defaultValue?string | number

The value it starts with. A form reset returns here.

Type
string | number
controller?InputController

Reads and writes the field from anywhere. Create one with createInputController().

debug?boolean

Logs every state change with its reason to the console, in development builds.

disabled?boolean

Disables the field.

readOnly?boolean

Makes the field read-only.

required?boolean

Makes the field required.

#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

EventType
@value-change(value: string, details: ChangeDetails<InputValueChangeReason>) → void

Called when the user changes the value: typing ("input-change"), a Clear part ("clear-press"), a form reset ("reset") or a controller ("imperative"). details.cancel() keeps the value as it was.

Type
(value: string, details: ChangeDetails<InputValueChangeReason>) → void
Parameters

value – string

details – ChangeDetails<InputValueChangeReason>

Returns
void
CSS variableType
--transform-originstring

Where the content scales from, on its trigger's side.

DatePickerContent

<div> data-slot="calendar-day"

PropType
align?Align

How the popup lines up with the anchor along that side. start and end follow the reading direction. How the popup lines up with the input along that side.

Default
"start"
alignOffset?number

Shift along the anchor, in pixels. Shift along the input, in pixels.

Default
0
anchor?string | Anchor | null

Positions the popup against this instead of its trigger: an element, a CSS selector, a point like { x, y }, or anything with getBoundingClientRect(). It's read on every check, so it can move. A controller's open({ anchor }) wins for that open.

Type
string | Anchor | null
arrowPadding?number

Space to keep between the arrow and the popup's corners, in pixels.

Default
6
collisionPadding?number

Space to keep from the viewport edges, in pixels.

Default
8
container?DocumentFragment | Element | null

Renders the popup into this element instead of in place, like a container inside a shadow root or an iframe. On web components, a CSS selector. Nested popups stay inside their parent.

Type
DocumentFragment | Element | null
finalFocus?PopupFocusTarget

Where focus goes when the popup closes while focus is inside it.

Default
"trigger"
keepMounted?boolean

Whether the popup stays in the page, hidden, while closed. Its content keeps its state between opens.

Default
false
side?Side

Which side of the anchor the popup opens on. Flips to the other side when there isn't room. Which side of the input the popup opens on.

Default
"bottom"
sideOffset?number

Gap between the anchor and the popup, in pixels. Gap between the input and the popup, in pixels.

Default
4
#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

AttributeType
data-align"start" | "center" | "end"

How the popup lines up with the input.

Type
"start" | "center" | "end"
data-closed?string

Present while the popup is closed, including while it animates out.

data-ending-style?string

Present while the popup animates out. Style the state you animate to.

data-open?string

Present while the popup is open.

data-presentation"popover" | "sheet"

How the popup presents this time it's open.

Type
"popover" | "sheet"
data-side"top" | "right" | "bottom" | "left"

Where the popup ended up, after flipping away from edges.

Type
"top" | "right" | "bottom" | "left"
data-starting-style?string

Present for the first frame. Style the state you animate from.

CSS variableType
--anchor-heightstring

Height of the anchor.

--anchor-widthstring

Width of the anchor, usually the trigger. Use it to match widths.

--arrow-offsetstring

Where the anchor's center falls along the popup's edge, kept arrowPadding from the corners. Position a ::before arrow with it.

--available-heightstring

Space between the anchor and the viewport edge. Use it for max-height. Not inherited, so a child that needs it copies it on the popup, like [--list-height:var(--available-height)], and reads max-h-(--list-height). The first popup registers both names for the whole page with CSS.registerProperty, so they don't inherit anywhere. A page that needs them to inherit calls it first, with inherits: true. An @property rule can't, since a registration in script wins.

--available-widthstring

Space beside the popup, up to the viewport edge. Not inherited either.

--drawer-dimstring

While it presents as a sheet: how dim the page behind is, from 0 to 1. The backdrop's opacity follows it.

--drawer-expandstring

While it presents as a sheet: 0 at the second-largest snap point and below, 1 at the largest. With one snap point, the whole travel.

--drawer-progressstring

While it presents as a sheet: how far open the sheet is, from 0 closed to 1 at its largest snap point. Never past 1.

--drawer-stackstring

While it presents as a sheet: how many sheets opened from inside this one are open above it, rising smoothly as each one opens. Push it back with it.

--sheet-backdropstring

Set it yourself: the color the page dims to while it presents as a sheet. Black at 0.2 by default.

--transform-originstring

The point on the anchor the popup opens from. Use it to scale from the right place.

DatePickerValue

<span>

PropType
placeholder?string
separator?string

What goes between two dates.

Default
"
class?string

Merged with the part's classes.

DatePickerPresetTrigger

<button> data-slot="date-picker-preset"

PropType
valueDateValue[]

The dates it picks: one, or a range's two.

#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

AttributeType
data-selected?string

Present while the preset's value is the one selected.

DatePickerLabel

<label> data-slot="calendar-label"

PropType
class?string

Merged with the part's classes.

DatePickerClearTrigger

<button> data-slot="date-picker-clear"

PropType
#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

AttributeType
data-empty?string

Present when there's no date to clear.

DatePickerViewDate

<h2>

PropType
#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

DatePickerTodayTrigger

data-slot="calendar-today-trigger"

PropType
clickEffect?boolean

Apply a click effect to the button.

Default
true
debug?boolean

Logs every state change with its reason to the console, in development builds.

disabled?boolean

Stops presses. The button is natively disabled, so it leaves the tab order and its form doesn't submit through it, unless focusableWhenDisabled is set.

Default
false
focusableWhenDisabled?boolean

Keeps a disabled button in the tab order with aria-disabled instead of the native attribute, so it can hold focus while it becomes disabled and host a tooltip that says why. Presses still do nothing.

Default
false
isLoading?boolean

Show a loading indicator.

Default
false
pendingAnnouncement?string

What screen readers hear once the button has been pending for a second, so a slow action doesn't pass in silence. Set it in the page's language. An empty string says nothing.

Default
"Loading"
pill?boolean

Fully rounded corners.

Default
false
size?"default" | "icon" | "icon-lg" | "icon-md" | "icon-sm" | "icon-xl" | "icon-xs" | "lg" | "md" | "sm" | "xl" | "xs"

Button's default: md.

Type
"default" | "icon" | "icon-lg" | "icon-md" | "icon-sm" | "icon-xl" | "icon-xs" | "lg" | "md" | "sm" | "xl" | "xs"
Default
"lg"
type?"button" | "reset" | "submit"

What a native button does in a form: "submit" submits it and "reset" resets it. Ignored when the button renders as something else.

Type
"button" | "reset" | "submit"
Default
"button"
variant?"default" | "destructive" | "ghost" | "link" | "outline" | "secondary"

Button's default: default.

Type
"default" | "destructive" | "ghost" | "link" | "outline" | "secondary"
Default
"outline"
#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

EventType
@click( event: MouseEvent, details?: ButtonActionDetails ) → unknown

Runs when the button is pressed. Return a Promise to keep it pending (data-pending) until it settles. details.source says how it was pressed; a wrapper passing the click on may leave it out.

Type
( event: MouseEvent, details?: ButtonActionDetails ) → unknown
Parameters

event – React.MouseEvent<HTMLButtonElement>

details? – ButtonActionDetails

Returns
unknown
CSS variableType
--cell-radiusstring
--cell-sizestring

DatePickerYearSelect

<div>

PropType
#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

DatePickerMonthSelect

<div>

PropType
#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

DatePickerView

PropType
view?DatePickerView
Default
"day"
class?string

Merged with the part's classes.

DatePickerViewTrigger

<button> data-slot="calendar-view-trigger"

PropType
class?string

Merged with the part's classes.

CSS variableType
--cell-radiusstring

DatePickerViewControl

<div> data-slot="calendar-view-control"

PropType
class?string

Merged with the part's classes.

DatePickerPrevTrigger

<button>

PropType
#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

AttributeType
data-size"icon-md"
Default
"icon-md"
data-variant"ghost"
Default
"ghost"

DatePickerNextTrigger

<button>

PropType
#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Merged with the part's classes.

AttributeType
data-size"icon-md"
Default
"icon-md"
data-variant"ghost"
Default
"ghost"

DatePickerTable

<table>

PropType
offset?number
Default
offsetOf(children)
class?string

Merged with the part's classes.

DatePickerTableHead

data-slot="calendar-table-head"

DatePickerTableRow

<tr> data-slot="calendar-table-row"

PropType
class?string

Merged with the part's classes.

CSS variableType
--cell-radiusstring
--cell-sizestring

DatePickerTableHeader

<th> data-slot="calendar-table-header"

PropType
class?string

Merged with the part's classes.

DatePickerTableBody

data-slot="calendar-table-body"

CSS variableType
--cell-radiusstring
--cell-sizestring

DatePickerTableCell

<table> data-slot="calendar-table-cell-trigger"

PropType
valueDateValue | number

The day, or a month (1 to 12) or year in those views.

Type
DateValue | number
disabled?boolean

Kept for the other bases: a day can't be picked when isDateUnavailable says so.

visibleRange?unknown

Kept for the other bases: the table's offset says which month a day is in.

class?string

Merged with the part's classes.

AttributeType
data-disabled?string
data-focus?string
data-in-range?string
data-outside-range?string
data-selected?string
data-value"${target.value}"
Default
"${target.value}"
data-view?string

Mirrors view.

CSS variableType
--cell-sizestring

DatePickerWeekNumberHeaderCell

<th> data-slot="calendar-week-number-header-cell"

PropType
class?string

Merged with the part's classes.

CSS variableType
--cell-sizestring

DatePickerWeekNumberCell

<th> data-slot="calendar-week-number-cell"

PropType
week?DateValue[]

Kept for the other bases: the row's days.

weekIndex?number

Kept for the other bases: the row's index.

class?string

Merged with the part's classes.

CSS variableType
--cell-sizestring

DatePickerWeekDays

<th>

PropType
format?"narrow" | "short" | "long"

Weekday label width. short is two letters (Su), matching the other calendar bases, or the whole short name where two letters would repeat (Arabic and Hebrew short names share their first two).

Type
"narrow" | "short" | "long"
Default
"short"
class?string

Merged with the part's classes.

DatePickerTableDays

DatePickerTableNextMonth

PropType
months?number

The number of months to offset.

Default
1

DatePickerTableMonths

PropType
columns?number

How many months each row holds.

Default
4
format?"short" | "long"

How month names are written: short (Jan) or long (January).

Type
"short" | "long"
Default
"short"

DatePickerTableYears

PropType
columns?number

How many years each row holds.

Default
4

useDatePicker