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";

Examples

Overview

Limits

Date of birth

Time picker

Two fields

Date input

DateTime input

Without Icon

Disabled

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.

PropTypeDefaultDescription
value / v-model:valueDateTime | nullnullSelected date (luxon)
@change(date: DateTime | null) => void—Emitted when the date changes, with the same value as update:value
idstring—Id of the trigger, for forms and labels
minDateTime—Earliest selectable date (inclusive)
maxDateTime—Latest selectable date (inclusive). Must not be before min
caption-layout"buttons" | "dropdown""buttons"Calendar header mode. Use dropdown for date of birth
show-timebooleanfalseShow time input below calendar
year-range[number, number]last 120 yearsMin/max years for dropdown caption
sizeControlSize"md"Trigger size (3xs to 3xl)
variant"outline" | "soft" | "ghost""outline"Trigger style
pillbooleantrueRounded trigger
blockbooleanfalseFull-width trigger
clearablebooleanfalseShow clear button
trigger-show-iconbooleantrueShow calendar icon
trigger-date-formatstring"MM/dd/yy"Date format in trigger. Auto-includes time when show-time is enabled
trigger-class-namestring—Class applied to the trigger
dropdown-icon-type"dropdown" | "chevronDown" | "none""dropdown"Icon at the end of the trigger
placeholderstring"Select date..."Trigger placeholder
disabledbooleanfalseDisable picker
side"top" | "right" | "bottom" | "left""bottom"Preferred side of the calendar popover
side-offsetnumber8Distance from the trigger in pixels
align"start" | "center" | "end""center"Alignment against the trigger
align-offsetnumber0 (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 (default var(--color-border-danger-outline))
  • --input-outline-border-color: outline border color (default var(--color-border-primary-outline))
  • --input-outline-border-color-hover: outline border color hover (default light-dark(var(--alpha-25), var(--alpha-30)))
  • --input-placeholder-text-color: placeholder text color (default var(--color-text-tertiary))
  • --input-text-color: text color (default var(--color-text))
  • --select-control-font-weight: font weight (default var(--font-weight-normal))