Date Picker
Select the dates for your project.
Select the dates for your project.
A labeled date field that opens a calendar popup; picks one ISO date, or a start and end date with range.
A Markdown brief for Claude, Cursor or v0: install, setup, props and a complete example.
For a date or a start and end date, picked from a calendar.
A date far in the past, like a birthday? A plain Text Input is often quicker.
The field is a button that opens the calendar. There, arrow keys move by day and week, Page Up and Page Down by month, and Escape closes it.
import { DatePicker } from '@idyeah/diya'Stable since 1.0.0
labelRequiredstringVisible label above the field; also names the trigger for assistive tech. Hide it with hideLabel.
disabledbooleanPrevents opening the calendar and dims the field.
Default false
errorstringVisible error message below the field; marks it invalid while set.
helperTextstringVisible hint below the field, announced with it; error replaces it while set.
hideLabelbooleanHides the label visually but keeps it as the trigger's accessible name.
Default false
isDateUnavailable(date: string) => booleanCalled with each ISO YYYY-MM-DD day on show; return true to mark the day unavailable (announced, and it can't be chosen), as with min and max.
maxstringLatest date that can be chosen, as ISO YYYY-MM-DD; later days show as unavailable.
minstringEarliest date that can be chosen, as ISO YYYY-MM-DD; earlier days show as unavailable.
namestringForm field name: the chosen date is sent with the form under it (in range mode, the start and then the end).
rangebooleanSingle-date mode (the default): leave unset or false. Range mode: the first click sets the start, the second the end (swapped if earlier).
size"small" | "medium" | "large"Trigger height and type size; defaults to 'medium'.
Default 'medium'
range={false} (the default)defaultValuestringThe initially chosen ISO date when uncontrolled; a form reset returns to it.
onValueChange(value: string) => voidCalled with the chosen ISO YYYY-MM-DD date, or '' when cleared.
valuestringThe chosen date as ISO YYYY-MM-DD, or '' for none, when controlled; pair it with onValueChange.
range={true}defaultValueDateRangeThe initially chosen range when uncontrolled; a form reset returns to it.
onValueChange(value: DateRange) => voidCalled with the new range after each click; end is '' until the second date is chosen.
valueDateRangeThe chosen range as ISO YYYY-MM-DD dates, a bound '' while unset, when controlled; pair it with onValueChange.
Also takes every native <button> attribute, such as name, id or data-*.