Date Field
Ввод даты по сегментам в порядке локали. Бесплатно, MIT · Формы и ввод › Дата и время
Установка
npx valyro-cli@latest add date-field
npx shadcn@latest add https://valyro.xyz/r/date-field.json
npm install valyro-ui
import 'valyro-ui/styles.css';
import { DateField } from 'valyro-ui';
Пропсы
| 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 date once every segment is filled, and with null when one is cleared. | |
locale | string | Order of day, month and year, the separators and the digits. Defaults to the ThemeProvider locale, then the browser's. | |
minDate | Date | Earliest valid day (time of day ignored): an earlier date marks the field invalid. | |
maxDate | Date | Latest valid day (time of day ignored): a later date marks the field invalid. | |
size | 'sm' | 'md' | 'lg' | 'md' | Field height and text size. |
disabled | boolean | false | Takes the segments out of the Tab order and leaves the date out of form data. |
readOnly | boolean | false | Focusable and readable, not editable. |
invalid | boolean | false | Danger border and aria-invalid. 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 incomplete). | |
required | boolean | Blocks native form submission while the date is incomplete; aria-required on the segments. | |
icon | ReactNode | <CalendarIcon /> | Icon before the segments; null for none. Default: a calendar. |
labels | Partial<DateFieldLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Похожие компоненты
- Date Picker — Выбор даты
- Date Range Picker — Выбор диапазона дат
- Time Picker — Выбор времени
- Time Field — Ввод времени по сегментам, 24 часа или AM/PM
- Wheel Picker — Барабан выбора в стиле iOS: инерция, 3D-цилиндр, пресеты даты и времени
- Date Of Birth Input — Дата рождения тремя списками в порядке локали
- Text Input — Текстовые поля
- Textarea — Многострочный ввод
- Search Input — Поисковая строка
- Mentions Input — Текст с @упоминаниями и #тегами, асинхронные подсказки
- Tags Input — Ввод тегов
- Select — Выбор из списка
Назад: Date Range Picker · Далее: Time Picker · Весь раздел «Формы и ввод»