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.
import { DatePicker } from "@strongtie/design-system/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 | - | |
variant | "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | - |
<DatePickerCalendar>| Prop | Type | Default | Description |
|---|---|---|---|
buttonVariant | "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | - |
Components can be styled using the className prop. The design system uses Tailwind CSS for styling.
CSS classes used by this component:
date-picker-buttondate-picker-calendardate-picker-contentdate-picker-icondate-picker-inputdate-picker-input-buttondate-picker-input-wrapperEnsure proper accessibility attributes are added when implementing this component.