Date Picker

A Calendar in a Popover, with a trigger whose label cross-fades as you pick. Comes with a range variant and smart presets.

Inputs

Pick the day you ship.

Playground

Tweak the props, the preview and the code follow.

Props
import { DatePicker } from "@/components/ui/date-picker"

<DatePicker
  value={value}
  onChange={setValue}
  placeholder="Pick a date"
/>

Installation

npx @plumsydev/plum-ui add date-picker

Also pulls in calendar, popover automatically.

Usage

import { DatePicker, DateRangePicker } from "@/components/ui/date-picker"
const [date, setDate] = React.useState<Date>()

<DatePicker value={date} onChange={setDate} />

Examples

Range with presets

Presets on the side, two months, and the dashboard numbers roll as the range changes.

Visitors
Signups

In a form

Works with Field: invalid state, error message, weekdays only.

Weekdays only, at least 48h ahead.

API Reference

DatePicker

PropTypeDefault
value

Controlled value.

Date—
defaultValue

Initial value when uncontrolled.

Date—
onChange

Called on select and on clear.

(date: Date | undefined) => void—
placeholder

Shown when empty.

string"Pick a date"
formatOptions

How the value is displayed.

Intl.DateTimeFormatOptions{ dateStyle: "medium" }
locale

Used for the label and the calendar.

string"en-US"
minDate / maxDate

Bounds passed to the calendar.

Date—
disabledDates

Disable specific days.

(date: Date) => boolean—
clearable

Shows an × to reset the value.

booleantrue
align

Popover alignment.

"start" | "center" | "end""start"

DateRangePicker

Same props as DatePicker, with a DateRange value.

PropTypeDefault
presets

Shortcuts on the side. Pass `[]` to hide them.

{ label: string; range: () => DateRange }[]—
numberOfMonths

Months shown in the popover.

1 | 22

Notes

  • The popover closes on its own once a date — or both ends of a range — are picked, after a short beat so you see the selection land.