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>This component accepts the following custom props. For additional props inherited from Radix UI primitives see the Radix UI documentation.
| 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>This component accepts the following custom props. For additional props inherited from Radix UI primitives see the Radix UI documentation.
| Prop | Type | Default | Description |
|---|---|---|---|
formatDate | ((date: Date) => string) | - | Custom function to format the date for display. If not provided, uses the default toLocaleDateString() format. |
placeholder | string | Select date | Placeholder text displayed when no date is selected. |
size | default | sm | lg | icon | 'default' | The size of the button, affecting padding and font size. |
variant | link | default | secondary | outline | ghost | destructive | 'default' | The visual style variant of the button. |
Components can be styled using the className prop. The design system uses Tailwind CSS for styling.
The following data attributes are used to identify component parts:
date-pickerdate-picker-buttondate-picker-calendardate-picker-contentdate-picker-inputdate-picker-triggerOther CSS classes used by this component:
date-picker-buttondate-picker-calendardate-picker-contentdate-picker-icondate-picker-icon-downdate-picker-inputdate-picker-input-buttondate-picker-input-wrapperThis component inherits accessibility features from Radix UI, including: