Time input
A time typed one segment at a time on the locale's clock, where a highlight glides between the segments and each number rolls to its new value.
Examples
Default
Type the time, or step each segment with the arrow keys: the highlight follows you and each number rolls to its new value, as in the Date input.
Locale
locale sets the clock, the order and the names of AM and PM; without it, the field follows the browser’s language.
Hour cycle
hourCycle sets a 12-hour or a 24-hour clock whatever the locale; the value is a 24-hour time either way.
Granularity
granularity='second' adds a seconds segment, and the value becomes HH:mm:ss. granularity='hour' leaves the minutes out, and the value is HH:00.
Min and max
A time outside min and max shows as invalid, and a form won’t submit it. A min later than max runs over midnight.
Controlled
Hold the value with value and onValueChange; a value set from outside rolls each number the way it went.
Installation
npx shadcn@latest add https://kinoui.com/r/time-input.json- Files
lib/dates.tslib/segments.tslib/refs.tslib/field-control.tsxlib/segment-field.tsxlib/reduce-motion.tscomponents/kino/input.tsxlib/resize.tslib/run-progress.tslib/highlight.tslib/roll.tsxlib/scroll.tslib/segmented-input.tsxcomponents/kino/time-input.tsx- Packages
@base-ui/react- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
Props
Accessibility
- Each segment is a spin button with its own name (hour, minute, AM/PM) and the field’s label: the arrow keys step it and wrap, the hour within AM or PM, Page Up and Page Down step 2 hours or 15 minutes, and Home and End go to its first and last value.
- A segment moves on as soon as no other digit could follow, a separator key moves on, a or p picks AM or PM in any language, and Backspace on an empty segment goes back. Left and right arrows follow the screen, in right-to-left pages too.
- Pasting
14:30or2:30 PMfills every segment. - A time out of range is invalid for the form and shows the invalid icon, so it never relies on colour alone.
- When the system asks for less motion, the highlight moves in place and the numbers crossfade.