Components
Date Picker
A component that allows users to select a date from a calendar popup.
Demo
Code
Select date
Installation
Usage
Basic Usage
Variants
Trigger Variants
Trigger Sizes
Custom Date Format
With Min/Max Dates
Without Icon
API Reference
DatePicker
Root component.
| Prop | Type | Default | Description |
|---|---|---|---|
value | Date | — | Selected date |
onValueChange | (date: Date) => void | — | Callback when date changes |
variant | 'date' | 'month' | 'year' | 'date' | Picker variant |
minDate | Date | — | Minimum selectable date |
maxDate | Date | — | Maximum selectable date |
triggerVariant | 'default' | 'outline' | 'filled' | 'default' | Trigger style |
triggerSize | 'sm' | 'md' | 'lg' | 'md' | Trigger size |
DatePickerTrigger
The button that opens the calendar.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | Required | Trigger content |
className | string | — | Additional classes |
DatePickerContent
The calendar popup.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional classes |
DatePickerValue
Display component for the selected date.
| Prop | Type | Default | Description |
|---|---|---|---|
placeholder | string | 'Select date' | Placeholder text |
format | string | 'MMM DD, YYYY' | Date format (dayjs) |
showIcon | boolean | true | Show calendar icon |
className | string | — | Additional classes |
Date Formats
Using dayjs format tokens:
| Token | Output | Example |
|---|---|---|
YYYY | 4-digit year | 2024 |
YY | 2-digit year | 24 |
MMMM | Full month | December |
MMM | Short month | Dec |
MM | 2-digit month | 12 |
M | Month | 12 |
DD | 2-digit day | 05 |
D | Day | 5 |
dddd | Full weekday | Tuesday |
ddd | Short weekday | Tue |