DatePicker
A date field you can type into or pick from a calendar, read in the locale's format, with a time of day if you want one.
Import
import { DatePicker } from '@vitral/vue';Basic
Month and year
The month and the year in the calendar's title are buttons. The year opens a page of twenty years, a year opens its months, and a month opens its days, so a date decades away is three presses rather than hundreds of months paged through. The arrow keys move through either grid, PageUp and PageDown turn the page, and Escape goes back to the days.
Without the month or the year grid
Both are on by default and each is a prop. `:year-picker="false"` leaves the year as text, for dates that belong to one year; `:month-picker="false"` leaves the month as text, and a year chosen from the grid keeps the month on show. With both off the title is only text and the calendar is paged a month at a time.
Typing into the format
A `date-format` of fixed width types into its own shape by default: `dd/MM/yyyy` gives `__/__/____`, digits only, the separators typed for you. Half a date is put back when the box is left, and one pasted without its zeros, as `1/2/2026`, is read as a date first. A format with a month name has no fixed width and is left free; `:mask="false"` frees any of them, and a mask of your own replaces the derived one.
With a time
`show-time` adds a time field under the days. The box writes the time after the date and reads one typed there; choosing a day keeps the time already chosen and leaves the calendar open for it. `time-step` sets the minutes between the times listed, and any minute can still be typed. `min-time` and `max-time` keep every time inside the day you allow, the right-hand one here from 08:00 to 18:00.
Constraints
Only the next 30 days, no weekends, and two blocked days. Unselectable days are skipped by the keys and cannot be clicked or typed.
Inline
The calendar on its own, without the field.
Sizes, variants and states
Fluid
API
Read from packages/vue/src/components/DatePicker/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| dateFormat | string | A `formatDate` pattern (`yyyy yy MMMM MMM MM M dd d`); defaults to the locale's `dateFormat`. |
| minDate | Date | null | The earliest selectable day. |
| maxDate | Date | null | The latest selectable day. |
| disabledDates | Date[] | Days that cannot be chosen. |
| disabledDays | number[] | Weekdays that cannot be chosen, 0 = Sunday. |
| showTodayButton | boolean | A footer button that selects today. |
| showClearButton | boolean | A footer button that empties the value. |
| monthPicker | boolean | Whether the month in the calendar's title opens a grid of the twelve months. On by default; off, the month is only text and is reached by paging. |
| yearPicker | boolean | Whether the year in the calendar's title opens a grid of years. On by default; off, the year is only text. With the month grid off as well, the calendar can only be paged a month at a time. |
| showTime | boolean | Take a time of day with the date. The calendar gains a time field under its days, the text box writes the time after the date and reads one typed there, and choosing a day keeps the calendar open for the time. Off by default. |
| timeStep | number | Minutes between the times the time field offers. Defaults to 30; any minute can still be typed. |
| minTime | number | string | null | The earliest time of day, as minutes past midnight or `'08:00'`. A time chosen or typed before it is moved up to it. |
| maxTime | number | string | null | The latest time of day, likewise. |
| hour12 | boolean | Force twelve- or twenty-four-hour time; defaults to what the locale writes. |
| mask | boolean | MaskProp | Whether the text box types into the shape the date is written in. On by default: a `dateFormat` of fixed width (`dd/MM/yyyy`, `yyyy-MM-dd`, with a twenty-four-hour time after it) gives `99/99/9999`, and a format with a month name or a day without its zero gives none. `false` leaves the box free; a mask of your own, as InputMask takes, replaces the derived one. |
| firstDayOfWeek | number | 0 = Sunday; defaults to the locale's `firstDayOfWeek`. |
| placeholder | string | — |
| inline | boolean | Show the calendar in place, without a text box or popup. |
| size | Size | — |
| variant | InputVariant | Defaults to the plugin's `inputVariant`. |
| invalid | boolean | — |
| disabled | boolean | — |
| readonly | boolean | — |
| fluid | boolean | — |
| placement | OverlayPlacement | — |
| appendTo | string | `'body'` (the default), `'self'` to render in place, or a selector. |
Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.
Emits
| Event | Payload | Description |
|---|---|---|
| dateSelect | date: Date | A day was chosen in the calendar, or typed and committed; with `showTime`, also a time. |
| clear | — | — |
| show | — | — |
| hide | — | — |
| monthChange | event: DatePickerMonthChangeEvent | — |
| focus | event: FocusEvent | — |
| blur | event: FocusEvent | — |
Slots
| Name | Slot props | Description |
|---|---|---|
| date | (props: DatePickerDateSlotProps) | The content of one day cell. |
| footer | — | Extra content in the calendar's footer. |
| dropdownicon | — | The calendar button's icon. |