Type it or pick it
Type a date any way you would write it (9/17/26, 2026-09-17, Sep 17, tomorrow) and press Enter, or open the calendar and circle a day. Days before the 3rd are hatched out, so typing one turns the box red.
A date field with a calendar on a slip. Type a date (Sep 17, 2026, 9/17/26, 2026-09-17, tomorrow) or open the calendar and circle one; presets sit in a column beside it; the range version takes two months and closes when you have chosen both ends. Popover + Calendar + Button + Input, composed.
npx shadcn@latest add @wobko/date-pickerFirst time here? Add the registry to components.json first. How to install
Type a date any way you would write it (9/17/26, 2026-09-17, Sep 17, tomorrow) and press Enter, or open the calendar and circle a day. Days before the 3rd are hatched out, so typing one turns the box red.
A column of shortcuts beside the calendar. A preset can be a function, so 'in a week' is worked out when you choose it, not when the page was drawn.
Two ends in one field. Type 'Sep 9, 2026 to Sep 24, 2026' or open the two-month calendar: each week of the range gets one highlighter swipe, and the slip puts itself away when the second end is chosen.
typeable={false} makes the whole field a button that shows the date, like a Select. Below it: invalid, disabled and a dropdown caption for far-away dates such as birthdays.
In a real form: the date is a named field (the hidden input submits 2026-09-17), Mondays are closed, and the summary reads the submitted FormData.
One date. The field is the Select trigger's pencil box around a text input and a ghost calendar Button. Typing is read on Enter or when you leave the field (an unreadable date turns the box red until the next edit); ArrowDown opens the calendar. Works uncontrolled (`defaultValue`) and controlled (`value` + `onValueChange`; `value={undefined}` is a controlled, empty field; an Invalid Date counts as empty). Enter (or a second click) on the day that is already chosen confirms it and puts the slip away; only a field with `typeable={false}` clears it that way, having no other way to. Also exported: `parseDateInput(text, { format, locale, reference })` (a two-digit year is read within 50 years of `reference`, or as 1950 to 2049 without one) and `toIsoDate`.
| Prop | Type | Default | Description |
|---|---|---|---|
| value | Date | undefined | - | The chosen day (controlled). |
| defaultValue | Date | - | The chosen day (uncontrolled). |
| onValueChange | (date: Date | undefined) => void | - | Called when a day is typed, chosen or cleared. |
| typeable | boolean | true | `false` makes the whole field a button that shows the date (like a Select), for when free typing is not wanted. |
| format | string | "PP" | A date-fns format string used to show the date and, first, to read typed text. Other common forms (locale short / long, ISO, US, day-month-year with names) are tried after it. |
| locale | date-fns Locale | - | Names and patterns for showing and reading dates; passed on to the Calendar. date-fns cannot always read back what it wrote (a few locales' long and medium forms, e.g. Arabic "PP", Georgian, Kazakh): the shown text is never re-read unless it was edited, but pick a `format` such as `d MMM yyyy` if your users retype month names. Digits are Latin when typing (Eastern Arabic numerals are shown by the Calendar's `numerals` only). |
| min / max | Date | - | Earliest / latest allowed day. Earlier and later days are hatched out in the calendar and refused when typed. |
| disabledDates | Matcher | Matcher[] | - | More days that cannot be chosen (any react-day-picker matcher: `{ dayOfWeek: [0, 6] }`, `{ before: date }`, a function...). |
| presets | { label: string; value: Date | (() => Date) }[] | - | A column of shortcuts beside the calendar. A function is called when the preset is chosen, so 'in a week' is computed then. |
| closeOnSelect | boolean | true | Put the calendar away when a day is chosen. |
| name | string | - | Adds a hidden input with the day as `yyyy-MM-dd` for forms. A form reset (`<button type="reset">`) puts an uncontrolled picker back to its `defaultValue`, like a native input (a controlled one is yours to reset). |
| invalid | boolean | - | The red pencil box with a bang (also set by itself when the typed text cannot be read, until the next edit or a day chosen in the calendar). |
| invalidMessage | string | "Enter a date we can read." | What the browser says when a form is submitted with typed text that cannot be read (that text blocks the form through custom validity, so a click on Submit cannot send an empty date next to text that looks fine). Translate it. |
| disabled / readOnly / required / id / placeholder | - | As on an input. The label points at `id` (the text input, or the button when `typeable={false}`). | |
| open / defaultOpen / onOpenChange | - | Control the calendar slip. | |
| calendarProps | Partial<CalendarProps> | - | Passed to the Calendar: `captionLayout`, `showWeekNumber`, `weekStartsOn`, `numberOfMonths`, `today`, `footer`... |
| contentProps | Partial<PopoverContentProps> | - | Passed to the PopoverContent: `align`, `side`, `pin`, `tape`, `stock`, `className`... |
| calendarLabel | string | "Choose date" | Accessible name of the calendar button and of the dialog (translate it). |
| seed | string | number | - | Pins the hand: the same seed always draws the same field. |
Two dates in one field: "Sep 9, 2026 – Sep 24, 2026". Type both ends with a dash or 'to' between them (they are put in order), or open the two-month calendar: the first click starts the range, the second ends it and puts the slip away. Same props as DatePicker, with a `DateRange` value.
| Prop | Type | Default | Description |
|---|---|---|---|
| value / defaultValue / onValueChange | DateRange | undefined | - | `{ from, to }`. A single typed date is `{ from, to: undefined }`. |
| presets | { label: string; value: DateRange | (() => DateRange) }[] | - | Shortcuts: 'Last 7 days', 'This month'... |
| name / nameTo | string | - | Hidden inputs for the first and the last day (`yyyy-MM-dd`). |
The files the CLI copies into your project.
Loading the source