Join our Discord Community

Date Picker

React date picker with calendar popup, keyboard navigation, and date formatting. Built with Popover and Calendar components for forms and scheduling.

Need users to pick dates for forms, bookings, or scheduling? This date picker combines a clean button trigger with a full calendar popup. Perfect for birthdays, appointments, deadlines - any time you need date input that actually works.

Loading component...

Built by combining shadcn/ui's Popover and Calendar components with some date formatting magic.

npx shadcn@latest add popover calendar
npm install date-fns

Why developers choose this date picker

Built on React DayPicker with shadcn/ui components:

  • Smart popup positioning - Never gets cut off by container edges
  • Keyboard shortcuts - Arrow keys navigate, Enter selects, Escape closes
  • Mobile friendly - Touch-optimized calendar that works on any device
  • Date range support - Single dates, ranges, or multiple date selection
  • Flexible formatting - Display dates however your users expect
  • Form integration - Works seamlessly with React Hook Form and validation

Date picker patterns you'll actually use

Birthday and date of birth forms

Year/month dropdowns make it easy to pick dates way in the past:

Loading component...

Text input with calendar button

Let users type dates or click the calendar - covers all the bases:

Loading component...

Date and time scheduling

Perfect for appointment booking and event planning:

Loading component...

Smart date parsing

Users can type "tomorrow", "next Friday", "in 2 weeks" - no calendar clicking required:

Loading component...

Form validation made easy

Integrates perfectly with React Hook Form, Zod validation, and error handling:

Loading component...

What props can you customize?

Calendar Props

The main calendar component gives you tons of control:

PropTypeDefaultWhat it does
mode"single" | "multiple" | "range""single"Pick one date, multiple dates, or a range
selectedDate | Date[] | DateRange-Which date(s) are currently selected
onSelect(date: Date | undefined) => void-What happens when user picks a date
disabledMatcher | Matcher[]-Which dates can't be clicked
captionLayout"buttons" | "dropdown" | "dropdown-months" | "dropdown-years""buttons"How month/year navigation looks
fromDateDate-Earliest date users can pick
toDateDate-Latest date users can pick
defaultMonthDate-Which month shows up first
numberOfMonthsnumber1Show multiple months at once
weekStartsOn0 | 1 | 2 | 3 | 4 | 5 | 61Monday or Sunday first?
showOutsideDaysbooleanfalseShow grayed-out days from other months

Popover Props

Controls the floating calendar popup:

PropTypeDefaultWhat it does
openboolean-Force the calendar open/closed
onOpenChange(open: boolean) => void-Know when calendar opens/closes
modalbooleantrueBlock clicks outside? Usually yes

PopoverContent Props

Position the calendar exactly where you want it:

PropTypeDefaultWhat it does
align"start" | "center" | "end""center"Left, center, or right aligned
sideOffsetnumber4Space between button and calendar
alignOffsetnumber0Fine-tune the positioning
classNamestring-Custom styling

Date picker best practices

What works best in real applications:

  • Always label your date inputs - Screen readers and confused users will thank you
  • Keep date formats consistent - Pick MM/dd/yyyy or dd/MM/yyyy and stick with it
  • Disable impossible dates - No booking appointments in the past, no birthdays in the future
  • Show what format you expect - Placeholder text like "MM/DD/YYYY" prevents frustration
  • Handle timezones explicitly - Don't let date boundaries surprise your users
  • Test with keyboard only - Tab through everything, make sure it all works
  • Consider mobile users - Native date inputs might be better on phones