Xzero UI
Pro library

Date picker

Choose a date without losing context.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/date-picker
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/date-picker

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { DatePicker } from "@/components/xzero/date-picker/date-picker";

export function StartDateField() {
  const [start, setStart] = useState<Date>();
  return (
    <DatePicker
      label="Start date"
      value={start}
      onChange={setStart}
      minDate={new Date()}
      showToday
    />
  );
}

API reference

DatePicker

A field button that opens Calendar in a popover and shows the date with per-part rolling.

PropTypeDefaultDescription
label (required)string–Visible label tied to the trigger.
valueDate–Selected date.
onChange(date: Date | undefined) => void–Called on pick and with undefined from the Clear button.
descriptionstring–Helper copy under the field.
placeholderstring"Select a date"Shown with no value.
minDateDate–Earliest selectable day.
maxDateDate–Latest selectable day.
disabledDates(date: Date) => boolean–Return true to block a day.
localestring"en-US"Formatting and calendar locale.
formatIntl.DateTimeFormatOptions{ month: "short", day: "numeric", year: "numeric" }How the value is shown.
showTodayboolean–Adds a Today button to the calendar header.
...propsOmit<ButtonHTMLAttributes<HTMLButtonElement>, "value" | "onChange">–Forwarded to the trigger button, including id, disabled, and className (applied to the root).

Keyboard interactions

KeysAction
Enter / Space / ArrowDownOpens the calendar and focuses the selected or current day.
EscapeCloses the popover and returns focus to the trigger.
Calendar keysArrows, Home, End, PageUp, and PageDown navigate days as in Calendar.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in pickers

Guidance for AI tools

Date picker: Choose a date without losing context. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components