Shadcn Date Picker
React date picker for forms, bookings, and filters. Built with TypeScript and Tailwind CSS for Next.js using Popover and Calendar — single dates, ranges, and time.
There is no DatePicker in components/ui. You compose a Popover trigger with a Calendar in the panel. Click the button, pick a day, format it with date-fns. Use it for a booking, a birthday, a filter, or a schedule.
Looking for a neobrutalism version for shadcn?
Same date picker, thicker borders. The NeoBrutalism date picker is the kit if you want that look.
Usage
import { format } from "date-fns"
import { Button } from "@/components/ui/button"
import { Calendar } from "@/components/ui/calendar"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"<Popover>
<PopoverTrigger
render={
<Button
variant="outline"
data-empty={!date}
className="justify-start text-left font-normal data-[empty=true]:text-muted-foreground"
/>
}
>
{date ? format(date, "PPP") : "Pick a date"}
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar mode="single" selected={date} onSelect={setDate} />
</PopoverContent>
</Popover>mode="single" is one day. mode="range" is from/to. Control open if a click should close the panel.
Composition
There is no DatePicker root. The trigger is a Button; the grid is a Calendar.
Basic
A labeled trigger. The button shows PPP once a day is picked.
Range Picker
mode="range" and numberOfMonths={2}. Keep the panel open until both ends are set.
Date of Birth
captionLayout="dropdown" for month and year. Close open in onSelect so a birthday is one click.
Input
Type the date. Arrow Down opens the calendar. The icon lives in an Input Group.
Time Picker
A date field plus type="time". The calendar does not pick a clock — the native input does.
Natural Language Picker
chrono-node parseDate turns “in 2 days” or “next Friday” into a Date. The calendar stays in sync.
RTL
Wrap with DirectionProvider and dir="rtl". Pass a DayPicker locale so month names match the reading direction.
API
These are Calendar props. There is no DatePicker export.
Prop
Type
Popover
Prop
Type
align on PopoverContent defaults to center. Date pickers usually set align="start".
Keyboard
| Key | Action |
|---|---|
Space / Enter | Open the panel, or select the focused day |
Arrow keys | Move between days |
Page Up / Page Down | Previous / next month |
Home / End | First / last day of the week |
Escape | Close and return focus to the trigger |
Notes
ISO strings shift a day
new Date("2025-06-01") is UTC midnight. In the US that is still May 31. Use new Date(2025, 5, 1) or parse a local date.
There is no components/ui/date-picker.tsx. Compose Popover and Calendar.
With other components
Grid inside the panel
PopoverFloats next to the trigger
ButtonShows the picked date
FieldLabel stacked on the trigger
InputType instead of click
Input GroupCalendar icon on the field
Questions
Related
Was this page helpful?
Sign in to leave feedback.
Data Table
React data table for payments, users, and admin lists. Built with TypeScript and Tailwind CSS for Next.js using Table and TanStack Table — sort, filter, paginate.
Dialog
React dialog for profile forms, share sheets, and settings. Built with TypeScript and Tailwind CSS for Next.js using Base UI — focus trap and a required title.