Date Picker
Date selection. Free, MIT · Forms and input › Date and time
Installation
npx valyro-cli@latest add date-picker
npx shadcn@latest add https://valyro.xyz/r/date-picker.json
npm install valyro-ui
import 'valyro-ui/styles.css';
import { DatePicker } from 'valyro-ui';
Props
| Prop | Type | Default | |
|---|---|---|---|
value | Date | null | Controlled value; use with onValueChange. | |
defaultValue | Date | null | null | Initial value when uncontrolled. |
onValueChange | (value: Date | null) => void | Called with the new value when it changes. | |
open | boolean | Controlled open; use with onOpenChange. | |
defaultOpen | boolean | false | Initial open when uncontrolled. |
onOpenChange | (open: boolean) => void | Called with the new open when it changes. | |
placeholder | string | 'Pick a date' | Text shown in the trigger while no date is picked. |
locale | string | BCP 47 locale for numbers and dates; defaults to the ThemeProvider's, then the browser's. | |
weekStartsOn | 0 | 1 | 2 | 3 | 4 | 5 | 6 | First day of the week in the calendar grid: 0 = Sunday, 1 = Monday (when omitted). | |
minDate | Date | Earliest selectable day (time of day ignored); earlier days are disabled. | |
maxDate | Date | Latest selectable day (time of day ignored); later days are disabled. | |
isDateDisabled | (date: Date) => boolean | Return true to disable a day, e.g. weekends or booked dates. | |
size | 'sm' | 'md' | 'lg' | Trigger height and text size. | |
invalid | boolean | Danger border on the trigger. Also shown after a submit attempt while a required date is missing. | |
name | string | Submits the date with the surrounding form as YYYY-MM-DD (empty when unset). | |
required | boolean | Blocks native form submission while no date is picked. | |
labels | Partial<DatePickerLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Related components
- Date Range Picker — Date range selection
- Date Field — Date typed segment by segment in the locale order
- Time Picker — Time selection
- Time Field — Time typed segment by segment, 24-hour or AM/PM
- Wheel Picker — iOS-style picker wheel: momentum, 3D cylinder, date and time presets
- Date Of Birth Input — Date of birth as three selects in locale order
- Text Input — Text fields
- Textarea — Multiline text input
- Search Input — Search field
- Mentions Input — Text with @mentions and #tags, async suggestions
- Tags Input — Tag entry
- Select — Pick one option from a list
Previous: Masked Input · Next: Date Range Picker · All Forms and input