Make your AI a shadcn expert

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.

Scroll to load preview...

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

PopoverTrigger
Calendar

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.

Scroll to load preview...

Range Picker

mode="range" and numberOfMonths={2}. Keep the panel open until both ends are set.

Scroll to load preview...

Date of Birth

captionLayout="dropdown" for month and year. Close open in onSelect so a birthday is one click.

Scroll to load preview...

Input

Type the date. Arrow Down opens the calendar. The icon lives in an Input Group.

Scroll to load preview...

Time Picker

A date field plus type="time". The calendar does not pick a clock — the native input does.

Scroll to load preview...

Natural Language Picker

chrono-node parseDate turns “in 2 days” or “next Friday” into a Date. The calendar stays in sync.

Scroll to load preview...

RTL

Wrap with DirectionProvider and dir="rtl". Pass a DayPicker locale so month names match the reading direction.

Scroll to load preview...

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

KeyAction
Space / EnterOpen the panel, or select the focused day
Arrow keysMove between days
Page Up / Page DownPrevious / next month
Home / EndFirst / last day of the week
EscapeClose 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

Questions

Was this page helpful?

Sign in to leave feedback.