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

Time Picker

Time selection. Free, MIT · Forms and input › Date and time

Installation

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

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

Props

PropTypeDefault
valuestring | null24-hour "HH:mm" string.
defaultValuestring | nullnullInitial value when uncontrolled.
onValueChange(value: string | 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.
hourCycle12 | 24Display and pick in 12-hour (AM/PM) or 24-hour format; defaults to the locale's clock. The value is always 24-hour.
minuteStepnumber5Minutes between options in the minute column.
placeholderstring'Pick a time'Text shown in the trigger while no time is picked.
localestringLocale for digits and AM/PM names. Defaults to the ThemeProvider locale, then the browser's.
size'sm' | 'md' | 'lg'Trigger height and text size.
invalidbooleanDanger border on the trigger. 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 unset).
requiredbooleanBlocks native form submission while no time is picked.
inlinebooleanfalseKeeps the columns open in the page flow under the field instead of in a popover (a settings page, a showcase). open, defaultOpen and onOpenChange do not apply, and the columns never take focus by themselves: the field moves focus into them on click or ArrowDown.
labelsPartial<TimePickerLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Date Field · Next: Time Field · All Forms and input