Input Time
newTime is money. This one's free.
Selected: 09:30:00
Open Props in the corner of the example to try variant, size, disabled, readonly and loading. disabled fades the frame and the segments; readonly keeps the time focusable but not editable.
The five text control variants, the same as on Input.
The field runs from 28px at xs to 48px at xl, the heights of the matching inputs.
Installation
Usage
<script setup lang="ts">
import { Time } from '@internationalized/date'
import type { TimeValue } from 'reka-ui'
import { InputTime } from '@/components/ui/input-time'
const time = shallowRef<TimeValue | undefined>(new Time(9, 30))
</script>
<template>
<InputTime v-model="time" />
</template>
Hours, minutes and AM/PM (in 12-hour time) are separate segments. Type digits or use the arrow keys; once a segment is full, focus jumps to the next one.
v-model is a Time from @internationalized/date, or undefined until every segment is filled.
Set name, and it submits as HH:mm:ss. Enter submits the form, like a native time input. Give it an aria-label, or put it in a Field.
focus and blur fire once when focus enters or leaves the field, not for every segment, so a form library's validate-on-blur works. Clicking the frame outside the segments focuses the first one.
Examples
Range
InputTimeRange puts a start and an end time in one frame. Its v-model is { start, end }.
With name, the form gets two fields, name[start] and name[end], each HH:mm:ss and empty until that end is filled. required needs both.
Hour cycle
hour-cycle is 24 or 12. It defaults to the locale's cycle; 12 adds the AM/PM segment, which A and P set.
Granularity
granularity decides the last segment: hour, minute (the default) or second.
Step
step sets how far an arrow key moves each segment, here 15 minutes. With step-snapping, a typed value snaps to the step.
The arrow keys move the minutes by 15.
Min and max
A time before min-value or after max-value marks the segments aria-invalid, which turns the frame destructive. Put invalid on the field to show the error.
Loading
loading puts a spinner at the end of the field and marks it aria-busy. Typing stays on.
Checking availability…
In an input group
Inside an InputGroup the field drops its own frame and takes the group's variant and size, so icons, text and buttons share one frame with it. Clicking an addon focuses the first segment.
API Reference
Both components accept class, merged over their base classes.
InputTime
| Prop | Default | Type and description |
|---|---|---|
| defaultValue | — | TimeValueThe starting time when |
| defaultPlaceholder | — | TimeValueThe starting placeholder when |
| placeholder | — | TimeValueThe time the segments step from while they are empty. Bound with |
| modelValue | — | TimeValue | nullThe time, bound with |
| hourCycle | — | HourCycle
|
| step | — | DateStepHow far the arrow keys move each segment, as |
| stepSnapping | — | booleanSnaps a typed value to the nearest step. |
| granularity | — | "hour" | "minute" | "second"The last segment shown: |
| hideTimeZone | — | booleanHides the time zone segment that a |
| maxValue | — | TimeValueThe latest valid time. A later one marks the segments invalid. |
| minValue | — | TimeValueThe earliest valid time. An earlier one marks the segments invalid. |
| locale | — | stringThe locale for the segment order and the literals. Defaults to the one Reka UI's |
| disabled | — | booleanDisables every segment. Also set by a disabled field. |
| readonly | — | booleanKeeps the segments focusable but not editable. |
| id | — | stringOverrides the |
| dir | — | DirectionThe reading direction. Defaults to the one Reka UI's |
| asChild | — | booleanRender the single child instead of a wrapper, merging the root's attributes and classes onto it. |
| as | — | AsTag | ComponentThe element or component to render. |
| name | — | stringSubmits the time as |
| required | — | booleanMarks the hidden form input required. Also set by a required field. |
| variant | "outline" | "outline" | "soft" | "filled" | "ghost" | "subtle"The text control look, shared with |
| size | "md" | "md" | "xs" | "sm" | "lg" | "xl"The field's height, from 28px at |
| loading | — | booleanShows a spinner at the end of the field and marks it |
| Event | Payload and description |
|---|---|
| update:modelValue | [date: TimeValue | undefined]Fires when a typed or stepped segment completes or clears the time. |
| update:placeholder | [date: TimeValue]Fires when the placeholder time changes. |
| focus | [event: FocusEvent]Fires once when focus enters the field, not for every segment. |
| blur | [event: FocusEvent]Fires once when focus leaves the field. |
InputTimeRange
| Prop | Default | Type and description |
|---|---|---|
| defaultValue | — | TimeRangeThe starting range when |
| defaultPlaceholder | — | TimeValueThe starting placeholder when |
| placeholder | — | TimeValueThe time the segments step from while they are empty. Bound with |
| modelValue | — | TimeRange | nullThe range, bound with |
| hourCycle | — | HourCycle
|
| step | — | DateStepHow far the arrow keys move each segment, as |
| granularity | — | "hour" | "minute" | "second"The last segment shown: |
| hideTimeZone | — | booleanHides the time zone segment that a |
| maxValue | — | TimeValueThe latest valid time. A later one marks the segments invalid. |
| minValue | — | TimeValueThe earliest valid time. An earlier one marks the segments invalid. |
| locale | — | stringThe locale for the segment order and the literals. Defaults to the one Reka UI's |
| disabled | — | booleanDisables every segment. Also set by a disabled field. |
| readonly | — | booleanKeeps the segments focusable but not editable. |
| id | — | stringOverrides the |
| dir | — | DirectionThe reading direction. Defaults to the one Reka UI's |
| isTimeUnavailable | — | MatcherA function that returns |
| asChild | — | booleanRender the single child instead of a wrapper, merging the root's attributes and classes onto it. |
| as | — | AsTag | ComponentThe element or component to render. |
| name | — | stringSubmits |
| required | — | booleanMarks both hidden form inputs required, so the range needs both ends. Also set by a required field. |
| variant | "outline" | "outline" | "soft" | "filled" | "ghost" | "subtle"The text control look, shared with |
| size | "md" | "md" | "xs" | "sm" | "lg" | "xl"The field's height, from 28px at |
| loading | — | booleanShows a spinner at the end of the field and marks it |
| Event | Payload and description |
|---|---|
| update:modelValue | [date: TimeRange]Fires with |
| update:placeholder | [date: TimeValue]Fires when the placeholder time changes. |
| focus | [event: FocusEvent]Fires once when focus enters the field, not for every segment. |
| blur | [event: FocusEvent]Fires once when focus leaves the field. |
Props
- defaultValue
TimeValueThe starting time whenv-modelis not used.- defaultPlaceholder
TimeValueThe starting placeholder whenv-model:placeholderis not used.- placeholder
TimeValueThe time the segments step from while they are empty. Bound withv-model:placeholder.- modelValue
TimeValue | nullThe time, bound withv-model. ATimefrom@internationalized/date, orundefinedwhile a segment is empty.- hourCycle
HourCycle12or24. Defaults to the locale's cycle;12adds an AM/PM segment.- step
DateStepHow far the arrow keys move each segment, as{ hour, minute, second }.1by default.- stepSnapping
booleanSnaps a typed value to the nearest step.- granularity
"hour" | "minute" | "second"The last segment shown:hour,minute(the default) orsecond.- hideTimeZone
booleanHides the time zone segment that aZonedDateTimevalue shows.- maxValue
TimeValueThe latest valid time. A later one marks the segments invalid.- minValue
TimeValueThe earliest valid time. An earlier one marks the segments invalid.- locale
stringThe locale for the segment order and the literals. Defaults to the one Reka UI'sConfigProvidersets.- disabled
booleanDisables every segment. Also set by a disabled field.- readonly
booleanKeeps the segments focusable but not editable.- id
stringOverrides theidtaken from a surrounding field. It lands on the hidden input, so the field's label focuses the first segment.- dir
DirectionThe reading direction. Defaults to the one Reka UI'sConfigProvidersets.- asChild
booleanRender the single child instead of a wrapper, merging the root's attributes and classes onto it.- as
AsTag | ComponentThe element or component to render.- name
stringSubmits the time asHH:mm:sswith the form under this name, through a hidden input.- required
booleanMarks the hidden form input required. Also set by a required field.- variant
"outline" "outline" | "soft" | "filled" | "ghost" | "subtle"The text control look, shared withInput:outline,soft,filled,ghostorsubtle. Inside an input group, the group's.- size
"md" "md" | "xs" | "sm" | "lg" | "xl"The field's height, from 28px atxsto 48px atxl. Inside an input group, the group's.- loading
booleanShows a spinner at the end of the field and marks itaria-busy.
Emits
- update:modelValue
[date: TimeValue | undefined]Fires when a typed or stepped segment completes or clears the time.- update:placeholder
[date: TimeValue]Fires when the placeholder time changes.- focus
[event: FocusEvent]Fires once when focus enters the field, not for every segment.- blur
[event: FocusEvent]Fires once when focus leaves the field.
Props
- defaultValue
TimeRangeThe starting range whenv-modelis not used.- defaultPlaceholder
TimeValueThe starting placeholder whenv-model:placeholderis not used.- placeholder
TimeValueThe time the segments step from while they are empty. Bound withv-model:placeholder.- modelValue
TimeRange | nullThe range, bound withv-model, as{ start, end }. Both areTimevalues from@internationalized/date.- hourCycle
HourCycle12or24. Defaults to the locale's cycle;12adds an AM/PM segment.- step
DateStepHow far the arrow keys move each segment, as{ hour, minute, second }.1by default.- granularity
"hour" | "minute" | "second"The last segment shown:hour,minute(the default) orsecond.- hideTimeZone
booleanHides the time zone segment that aZonedDateTimevalue shows.- maxValue
TimeValueThe latest valid time. A later one marks the segments invalid.- minValue
TimeValueThe earliest valid time. An earlier one marks the segments invalid.- locale
stringThe locale for the segment order and the literals. Defaults to the one Reka UI'sConfigProvidersets.- disabled
booleanDisables every segment. Also set by a disabled field.- readonly
booleanKeeps the segments focusable but not editable.- id
stringOverrides theidtaken from a surrounding field. It lands on the start's hidden input, so the field's label focuses the first segment.- dir
DirectionThe reading direction. Defaults to the one Reka UI'sConfigProvidersets.- isTimeUnavailable
MatcherA function that returnstruefor a time that cannot be picked.- asChild
booleanRender the single child instead of a wrapper, merging the root's attributes and classes onto it.- as
AsTag | ComponentThe element or component to render.- name
stringSubmitsname[start]andname[end]with the form, eachHH:mm:ssand empty while unset.- required
booleanMarks both hidden form inputs required, so the range needs both ends. Also set by a required field.- variant
"outline" "outline" | "soft" | "filled" | "ghost" | "subtle"The text control look, shared withInput:outline,soft,filled,ghostorsubtle. Inside an input group, the group's.- size
"md" "md" | "xs" | "sm" | "lg" | "xl"The field's height, from 28px atxsto 48px atxl. Inside an input group, the group's.- loading
booleanShows a spinner at the end of the field and marks itaria-busy.
Emits
- update:modelValue
[date: TimeRange]Fires with{ start, end }when a segment of either end changes.- update:placeholder
[date: TimeValue]Fires when the placeholder time changes.- focus
[event: FocusEvent]Fires once when focus enters the field, not for every segment.- blur
[event: FocusEvent]Fires once when focus leaves the field.
Data attributes
| data-slot | Attributes | Description |
|---|---|---|
| input-time | data-variant, data-size, data-disabled, data-readonly, data-invalid | The frame, a role="group", holding the hidden form input. Inside an input group it is input-group-control. |
| input-time-range | data-variant, data-size, data-disabled, data-readonly, data-invalid | The range's frame, the same as input-time, holding a hidden input for each end. |
| input-time-segment | data-reka-time-field-segment, data-placeholder, data-disabled, data-invalid, aria-invalid | One segment, a role="spinbutton", or a literal such as the colon. |
| input-time-range-separator | aria-hidden | The dash between the start and the end. |
Keyboard
| Key | Action |
|---|---|
| 0–9 | Types into the segment and moves to the next one when it is full. |
| ArrowUp / ArrowDown | Steps the segment by step, wrapping around. |
| ArrowLeft / ArrowRight | Moves focus to the previous or next segment. |
| Backspace | Deletes the last digit, then empties the segment. |
| A / P | Sets AM or PM in the 12-hour cycle. |
| Enter | Submits the form like a native time input. It clicks the submit button and does nothing while that button is disabled; without one, it submits only when this is the form's single text field. |