Date Picker
Date picker with an interactive calendar, time picker, year and month dropdowns, min/max limits, and date-of-birth presets.
import { DatePicker } from "@plexui/vue/components/DatePicker";On Phone, put a date picker in a row of a FieldGroup, as the Settings Forms do. In the row its trigger is the compact date of iOS: a capsule with the date that opens the calendar. The row is its frame and sets its height, insets and type, so the phone examples leave out size, pill and clearable and set :trigger-show-icon="false". To type a date instead, put a Date Input in the row.
Examples
Overview
Limits
Date of birth
Time picker
Dropdown + time
Two fields
Date input
DateTime input
Without Icon
API
Use aria-labelledby with the ID of a visible field label. The trigger includes that label and its current date or placeholder in its accessible name. aria-label, aria-describedby and aria-invalid also reach the trigger.
In the calendar, the arrow keys move focus by a day or a week, Home and End move it to the Sunday or Saturday of the week, and Page Up and Page Down move it by a month (January 31 goes to the last day of February). A day in another month turns the calendar to that month first. Focus stays put when the day it would move to is outside min and max. Enter and Space select the focused day.
| Prop | Type | Default | Description |
|---|---|---|---|
value / v-model:value | DateTime | null | null | Selected date (luxon) |
@change | (date: DateTime | null) => void | — | Emitted when the date changes, with the same value as update:value |
id | string | — | Id of the trigger, for forms and labels |
min | DateTime | — | Earliest selectable date (inclusive) |
max | DateTime | — | Latest selectable date (inclusive). Must not be before min |
caption-layout | "buttons" | "dropdown" | "buttons" | Calendar header mode. Use dropdown for date of birth |
show-time | boolean | false | Show time input below calendar |
year-range | [number, number] | last 120 years | Min/max years for dropdown caption |
size | ControlSize | "md" | Trigger size (3xs to 3xl) |
variant | "outline" | "soft" | "ghost" | "outline" | Trigger style |
pill | boolean | true | Rounded trigger |
block | boolean | false | Full-width trigger |
clearable | boolean | false | Show clear button |
trigger-show-icon | boolean | true | Show calendar icon |
trigger-date-format | string | "MM/dd/yy" | Date format in trigger. Auto-includes time when show-time is enabled and trigger-time-format is not set |
trigger-time-format | string | — | With show-time, the time format after the date in the trigger. The date and the time become two parts; in a phone row, two capsules |
trigger-class-name | string | — | Class applied to the trigger |
dropdown-icon-type | "dropdown" | "chevronDown" | "none" | "dropdown" | Icon at the end of the trigger |
placeholder | string | "Select date..." | Trigger placeholder |
disabled | boolean | false | Disable picker |
side | "top" | "right" | "bottom" | "left" | "bottom" | Preferred side of the calendar popover. On phones, left and right prefer bottom so all seven day targets fit. Top and bottom keep their preference; collisions can still flip placement. |
side-offset | number | 8 | Distance from the trigger in pixels |
align | "start" | "center" | "end" | "center" | Alignment against the trigger |
align-offset | number | 0 (center), -5 (start, end) | Offset from start/end alignment in pixels |
Styling
Date Picker reads these component tokens. Override them at any scope to restyle it:
--input-border-color-invalid: border color invalid (defaultvar(--color-border-danger-outline))--input-outline-border-color: outline border color (defaultvar(--color-border-primary-outline))--input-outline-border-color-hover: outline border color hover (defaultlight-dark(var(--alpha-25), var(--alpha-30)))--input-placeholder-text-color: placeholder text color (defaultvar(--color-text-tertiary))--input-text-color: text color (defaultvar(--color-text))--select-control-font-weight: font weight (defaultvar(--font-weight-normal))