Date and date-range picker: the field morphs into the calendar, the first day drops a ball and the range stretches across week rows as a pill.
Click meTap me
Request time off
Annual leave · 18 days left this year
Draft
28 Sept 2026 – 28 Dec 202712 – 17 Mar 2026
March 2026
Mo
Tu
We
Th
Fr
Sa
Su
Thu 12 – Tue 17 · 4 working days
date-picker · , lively
date-picker-demo.tsx
When to use
Use to pick one day or a start and end, typed or chosen on a calendar, with quick picks such as Last 30 days. Presets: field, report (toolbar button) and inline. Uses react-day-picker.
When not to use
For a static calendar with no field use the plain shadcn Calendar. For time of day use Time Picker.
Use it to pick one day or a start and an end in a form or a report filter, typed or chosen from
the calendar, with quick picks such as "Last 30 days". It has three presets: field (a text field
that opens the calendar in a popover), report (a compact period button for toolbars, with a
presets column and two months from 640px) and inline (the calendar in place, for booking and
leave panels). For a static calendar with no field and no motion, use the plain shadcn Calendar.
The date picker follows the MotionKit motion grammar in three beats. Pressing the field charges
it: it sinks. The calendar then morphs out of the field and the first chosen day drops a ball into
its cell (the action). In range mode, moving the pointer or the arrow keys toward the end
stretches a pill out of that ball, one pill per week row so the range bends at week ends. When the
end day is chosen the pill lands with the temperament's bounce and the field text crossfades
(settle). Changing month slides the grid in the direction of travel.
import { useState } from "react"import { DatePicker } from "@/components/ui/date-picker"export function DueDate() { const [due, setDue] = useState<Date | undefined>() return ( <div className="grid gap-1.5"> <label htmlFor="due" className="text-sm font-medium"> Due date </label> <DatePicker id="due" name="due" value={due} onValueChange={setDue} min={new Date()} clearable /> </div> )}
A range, with quick picks, as a period filter in a toolbar:
import { DatePicker, type DateRange } from "@/components/ui/date-picker"const [period, setPeriod] = useState<DateRange | undefined>()<DatePicker preset="report" mode="range" aria-label="Report period" value={period} onValueChange={setPeriod} presets={[ { label: "Last 7 days", value: () => ({ from: daysAgo(6), to: new Date() }) }, { label: "Last 30 days", value: () => ({ from: daysAgo(29), to: new Date() }) }, ]}/>
onValueChange fires on commit: in range mode when both ends are set, and on clear. With name
the picker submits ISO dates in hidden inputs (name, or name[from] and name[to] in range
mode). calendarProps passes locale, weekStartsOn, numberOfMonths, defaultMonth and the
other react-day-picker options through. Calendar is exported as the animated grid alone, and
DatePickerTrigger asChild lets the report preset use your own button.
Set the character for the whole app with MotionKitProvider, or per picker with temperament:
preset="field" is a typed field. Typing a date that does not parse shows an error under the field
(in a line the field keeps reserved, so nothing below it moves) and the ball stays where it was; once the text parses the ball jumps to the typed day. Here an
invoice form with a due date that cannot precede the issue date, quick picks and a disabled field.
preset="report" with mode="range" is a period button for an analytics toolbar: the presets
column on the left, two months side by side from 640px, one below. Picking a preset stretches the
pill to its range.
mode="single" is the default: one day, a Date value, and the calendar closes as soon as a day
is picked. Here the report button sets a task's due date, with quick picks for Today, Tomorrow
and Next Monday; picking one moves the ball to that day without closing, so the choice is visible.
The field preset is a text input with role="combobox", aria-haspopup="dialog" and
aria-expanded. The report preset is a button with the same attributes.
The popover is role="dialog", labelled "Choose date" or "Choose date range". react-day-picker
renders a grid per month with the month caption as its label, and each day is a button with its
full date as aria-label and aria-selected. The quick picks are a toolbar labelled "Quick
picks".
Give the field an accessible name: a <label htmlFor> pointing at its id, or aria-label.
A polite live region announces the chosen start, the committed range and the new month. A
typed-date error is announced and linked to the field with aria-describedby.
The ball, the pills and the today dot are decorative (aria-hidden); the selection is conveyed
by aria-selected. Disabled days are marked by a diagonal strike as well as color.
Focus shows a 3px ring in the theme's ring color on the field, days and quick picks, drawn above
the ball and pill. Opening moves focus to the selected day (or today); Escape and selection
return it to the field.
Colors come from your theme: primary-foreground on the primary ball and foreground on the
tinted pill keep AA contrast in light and dark. Outside-month days use muted-foreground, never
lower.
With reduced motion (the OS setting, or MotionKitProvider reducedMotion="always") there is no
field sink, day sink, ball drop or pill stretch. The calendar crossfades in place of the morph, the
ball fades in on the chosen day, the range pills fade between extents, the field text and the
months crossfade. The hover circle and focus ring still answer, and every frame shows a complete
calendar.
Only transform and opacity animate (field sink, ball drop, pill extent, month slide). The
calendar subtree mounts only when the popover opens.
Nothing loops: every movement is caused by a press, hover, key or typed date.
Size: the component and its MotionKit helpers are about 14.3 kB gzip, under the 15 kB Pro budget.
Third-party dependencies come on top, each with its own gzip size: react-day-picker with its
date-fns dependency about 19 kB (the library shadcn's Calendar uses), @radix-ui/react-popover
about 23 kB (shared with shadcn's Popover) and motion about 47 kB (shared by every MotionKit
component, installed once).
SSR-safe: today's date is read after mount, never during the server render.
Technical sheet
Motion
calm
260 ms · bounce 0
lively
400 ms · bounce 0.3
playful
540 ms · bounce 0.45
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom, @radix-ui/react-popover, motion.
Dependencies
@radix-ui/react-popover · peer
motion · peer
react-day-picker
Triggers
click, hover, press, typing, keyboard focus
Reduced motion
No sink, no drop and no stretch: the calendar crossfades in place of the morph, the ball fades in on the chosen day, the range pills fade between extents and months crossfade.
Keyboard
Alt + ArrowDown
From the field: opens the calendar and moves focus to the selected day (or today)
Enter / Space on the button
Report preset: opens the calendar on the selected day
ArrowLeft / ArrowRight
Previous / next day; in range mode with a start chosen, drags the preview pill
ArrowUp / ArrowDown
Same weekday in the previous / next week
Home / End
Start / end of the week
PageUp / PageDown
Previous / next month (the grid slides that way)
Shift + PageUp / PageDown
Previous / next year
Enter / Space on a day
Selects the day; in range mode the first press sets the start, the second the end
Escape
Cancels a half-chosen range first, then closes and returns focus to the field
ArrowUp / ArrowDown in the quick picks
Moves between presets
Tab
Moves between the field, quick picks, month buttons and the grid
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)