ValyroUI English version

Time Field

Ввод времени по сегментам, 24 часа или AM/PM. Бесплатно, MIT · Формы и ввод › Дата и время

Установка

npx valyro-cli@latest add time-field
npx shadcn@latest add https://valyro.xyz/r/time-field.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { TimeField } from 'valyro-ui';

Пропсы

PropTypeDefault
valuestring | null24-hour "HH:mm".
defaultValuestring | nullnullInitial value when uncontrolled.
onValueChange(value: string | null) => voidCalled with "HH:mm" once every segment is filled, and with null when one is cleared.
hourCycle12 | 2412 (with an AM/PM segment) or 24. Defaults to the locale's clock: 12 in en-US, 24 in most of Europe.
localestringOrder of the segments, the digits and the AM/PM names. Defaults to the ThemeProvider locale, then the browser's.
size'sm' | 'md' | 'lg''md'Field height and text size.
disabledbooleanfalseTakes the segments out of the Tab order and leaves the time out of form data.
readOnlybooleanfalseFocusable and readable, not editable.
invalidbooleanfalseDanger border and aria-invalid. Also shown after a submit attempt while a required time is missing.
namestringSubmits the time with the surrounding form as 24-hour HH:mm (empty when incomplete).
requiredbooleanBlocks native form submission while the time is incomplete; aria-required on the segments.
iconReactNode<ClockIcon />Icon before the segments; null for none. Default: a clock.
labelsPartial<TimeFieldLabels>Overrides for the built-in English text; keys left out keep their defaults.

Похожие компоненты

  • Date Picker — Выбор даты
  • Date Range Picker — Выбор диапазона дат
  • Date Field — Ввод даты по сегментам в порядке локали
  • Time Picker — Выбор времени
  • Wheel Picker — Барабан выбора в стиле iOS: инерция, 3D-цилиндр, пресеты даты и времени
  • Date Of Birth Input — Дата рождения тремя списками в порядке локали
  • Text Input — Текстовые поля
  • Textarea — Многострочный ввод
  • Search Input — Поисковая строка
  • Mentions Input — Текст с @упоминаниями и #тегами, асинхронные подсказки
  • Tags Input — Ввод тегов
  • Select — Выбор из списка

Назад: Time Picker · Далее: Wheel Picker · Весь раздел «Формы и ввод»