A field that opens a calendar for picking a date or a range.
string |
| – |
The id of the button, or of the (first) input, so a |
defaultOpen | boolean | false | Whether the calendar starts open, when |
defaultValue | Date|DateRange | – | The date, or |
disabled | Matcher | Matcher[] | – |
|
disableOutsideDays | boolean | false | Whether days from the previous and next months can't be selected. |
endName | string | – | The form field name of the end date, in |
fixedWeeks | boolean | true | Whether every month shows six weeks, so the calendar's height doesn't change between months. |
formatStr | "PPP"|"LLL dd, y"|"yyyy-MM-dd" | PPP | How the button shows a date: |
icon | ReactNode | – | Replaces this icon. Accepts any node; |
labels | Partial<DatePickerLabels> | – | Replaces the built-in text for this instance. See |
locale | string | – | A BCP 47 locale, such as |
maxDate | Date | – | The latest date that can be selected, by clicking or typing. |
minDate | Date | – | The earliest date that can be selected, by clicking or typing. |
mode | "single"|"range" | single | Whether the user picks one date ( |
name | string | – | The form field name. The date is submitted as YYYY-MM-DD; in |
numberOfMonths | number | 1 | How many months the calendar shows side by side. |
onOpenChange | ((open: boolean) => void) | – | Called when the calendar opens or closes. |
onSelect | ((value: Date | DateRange) => void) | – | Called with the new date, or the new |
open | boolean | – | Whether the calendar is open. Use with |
placeholder | string | – | The text shown when no date is selected. |
required | boolean | – | Whether a date is required. |
showOutsideDays | boolean | true | Whether the calendar shows the days of the previous and next months that fill the first and last weeks. |
side | "top"|"bottom"|"left"|"right"|"inline-end"|"inline-start" | bottom | The side of the trigger the calendar opens on. |
sideOffset | number | 8 | The gap between the trigger and the calendar, in pixels. |
triggerClassName | string | – | Classes for the button or input that opens the calendar. |
triggerSize | "lg"|"sm"|"default"|"xs" | default | The |
triggerType | "button"|"input" | button | What opens the calendar: a |
triggerVariant | "default"|"outline"|"secondary"|"ghost" | outline | The |
value | Date|DateRange|null | – | The selected date, or |
weekStartsOn | 0|1|2|3|4|5|6 | 0 | The first day of the week, from 0 for Sunday to 6 for Saturday. |