Getting Started
Foundations
Components
Search for a command to run...
DatePicker provides an intuitive interface for selecting dates by combining a text input or button trigger with a calendar popover. Users can either type dates directly into the input field or pick dates visually from the calendar. This component is ideal for forms, booking systems, scheduling interfaces, or any scenario requiring date input with both keyboard and mouse interaction options.
Built on top of Radix UI's Popover and the Calendar component, with full keyboard navigation, accessibility support, and flexible formatting options.
Registry Component: This component is available from the Strongtie
registry. Add it using: npx shadcn@latest add @strongtie/date-picker
Add this component from the Strongtie registry:
Or by URL:
This will install the component and all required dependencies:
import { DatePicker } from "@/components/ui/date-picker"This module exports the following components:
DatePickerDatePickerTriggerDatePickerContentDatePickerInputDatePickerButtonDatePickerCalendar<DatePickerInput>| Prop | Type | Default | Description |
|---|---|---|---|
onCalendarClick | (() => void) | - | Callback fired when the calendar icon button is clicked. |
onOpenPopover | (() => void) | - | Callback fired when the popover should open (on focus or input change). |
<DatePickerButton>| Prop | Type | Default | Description |
|---|---|---|---|
formatDate | ((date: Date) => string) | - | Custom function to format the date for display. If not provided, uses the default toLocaleDateString() format. |
open | boolean | - | Whether the date picker is currently open. |
placeholder | string | Select date | Placeholder text displayed when no date is selected. |
size | "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | - | Button size variant |
variant | "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | - | Button style variant |
<DatePickerCalendar>| Prop | Type | Default | Description |
|---|---|---|---|
buttonVariant | "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | - | Variant for calendar action buttons |