ValyroUI Русская версия

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

PropTypeDefault
valueDate | nullControlled value; use with onValueChange.
defaultValueDate | nullnullInitial value when uncontrolled.
onValueChange(value: Date | null) => voidCalled with the new value when it changes.
openbooleanControlled open; use with onOpenChange.
defaultOpenbooleanfalseInitial open when uncontrolled.
onOpenChange(open: boolean) => voidCalled with the new open when it changes.
placeholderstring'Pick a date'Text shown in the trigger while no date is picked.
localestringBCP 47 locale for numbers and dates; defaults to the ThemeProvider's, then the browser's.
weekStartsOn0 | 1 | 2 | 3 | 4 | 5 | 6First day of the week in the calendar grid: 0 = Sunday, 1 = Monday (when omitted).
minDateDateEarliest selectable day (time of day ignored); earlier days are disabled.
maxDateDateLatest selectable day (time of day ignored); later days are disabled.
isDateDisabled(date: Date) => booleanReturn true to disable a day, e.g. weekends or booked dates.
size'sm' | 'md' | 'lg'Trigger height and text size.
invalidbooleanDanger border on the trigger. Also shown after a submit attempt while a required date is missing.
namestringSubmits the date with the surrounding form as YYYY-MM-DD (empty when unset).
requiredbooleanBlocks native form submission while no date is picked.
labelsPartial<DatePickerLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Masked Input · Next: Date Range Picker · All Forms and input