Date Picker
ProNewA field that opens a calendar, writes the date in words and closes on a choice.
Installation
pnpm dlx shadcn@latest add @viewport/date-picker
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| value | Date | null | — |
| defaultValue | Date | null | null |
| onValueChange | (date: Date | null) => void | — |
| placeholder | stringShown while no date is chosen. | "Pick a date" |
| format | Intl.DateTimeFormatOptionsHow the chosen date is written in the field. | { day: "numeric", month: "short", year: "numeric" } |
| locale | string | — |
| min | Date | — |
| max | Date | — |
| isDateDisabled | (date: Date) => booleanReturn true for days that cannot be chosen. | — |
| weekStart | 0 | 1 | — |
| clearable | booleanShow a button that clears the date. | false |
Accessibility
- Opens with focus on the selected day and returns focus to the field.
- Escape and a press outside close it without changing the date.
- Works with Field for a label, a hint and an error.
- No scale animation under reduced motion.