Input Time

new

Time is money. This one's free.

Demo
9
30
AM

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.

Range
09
00
17
30

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.

Hour cycle
14
30
2
30
PM

Granularity

granularity decides the last segment: hour, minute (the default) or second.

Granularity
14
14
30
14
30
15

Step

step sets how far an arrow key moves each segment, here 15 minutes. With step-snapping, a typed value snaps to the step.

Step
10
15

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.

Min and max
19
30
We deliver between 09:00 and 18:00.

Loading

loading puts a spinner at the end of the field and marks it aria-busy. Typing stays on.

Loading
6
00
PM

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.

In a group
9
30
AM

API Reference

Both components accept class, merged over their base classes.

Data attributes

data-slotAttributesDescription
input-timedata-variant, data-size, data-disabled, data-readonly, data-invalidThe frame, a role="group", holding the hidden form input. Inside an input group it is input-group-control.
input-time-rangedata-variant, data-size, data-disabled, data-readonly, data-invalidThe range's frame, the same as input-time, holding a hidden input for each end.
input-time-segmentdata-reka-time-field-segment, data-placeholder, data-disabled, data-invalid, aria-invalidOne segment, a role="spinbutton", or a literal such as the colon.
input-time-range-separatoraria-hiddenThe dash between the start and the end.

Keyboard

KeyAction
0–9Types into the segment and moves to the next one when it is full.
ArrowUp / ArrowDownSteps the segment by step, wrapping around.
ArrowLeft / ArrowRightMoves focus to the previous or next segment.
BackspaceDeletes the last digit, then empties the segment.
A / PSets AM or PM in the 12-hour cycle.
EnterSubmits 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.

Changelog

  1. registry 0.22.0

    74d8f9f — InputTime and InputTimeRange stay empty when the parent clears their v-model and a change of granularity or hourCycle then remounts the segments; they used to bring back the last typed value.

    c227d32 — A required InputTimeRange whose end is missing when the form submits focuses the end's first segment instead of the start's.

  2. registry 0.16.0

    f6972bc — add input-time installs @internationalized/date. InputTime's value is a Time from that package, which a project has to import to set one, and pnpm doesn't let a project import what only reka-ui depends on.

  3. registry 0.13.0

    936ab40 — New InputDate and InputDateRange: segmented date fields over Reka UI's DateField and DateRangeField, in Input's five variants and five sizes, with optional time segments, min-value/max-value, is-date-unavailable, loading and Field wiring. Inside an InputGroup they drop their own frame and take the group's variant and size. Pasting an ISO date (2025-03-14, or 2025-03-14T09:30) fills every segment, and Enter submits the form through its submit button, like a native date input. InputDateRange submits name[start] and name[end] as ISO dates, empty until that end is filled, and required needs both.

    InputTime and InputTimeRange get the same fixes. focus and blur now fire once when focus enters or leaves the field, so a form library's validate-on-blur runs; before, they never fired. Clicking the frame outside the segments focuses the first one, Enter submits the form, and changing granularity or hour-cycle after mount rebuilds the segments instead of leaving stale ones. InputTimeRange with name now submits name[start] and name[end] instead of one start - end field, which read undefined - undefined while empty and never failed required. If your server reads the old field, read the two new ones.

    0e81516 — Enter in InputDate, InputDateRange, InputTime and InputTimeRange follows a native input's implicit submission exactly: it clicks the form's submit button, does nothing while that button is disabled, and in a form without one submits only when the field is the form's single text field. Before, a form without a submit button was submitted whatever else it held.

  4. registry 0.12.0

    c79028b — The control scale is now a set of tokens: --control-height-*, --control-padding-*, --control-icon-* and --control-gap-* for xs to xl, added to :root by the tokens item. Button, Input, InputFloating, Select, Combobox, InputNumber, TagsInput, PinInput, InputTime, InputGroup, Menu, Tabs, ColorPicker and Pagination read them, so overriding one on :root resizes every control of that size.

    Some sizes that strayed from the scale now follow it. Button icons are 20px at lg and xl instead of 16px, and so are the icons of Toggle, ToggleGroup, Toolbar and Pagination at those sizes. The gap between an icon and its label is 6, 8, 8, 10 and 12px from xs to xl, about half the icon, everywhere that has one: Button and the components built on it (where it was 4, 6, 8, 8 and 8px), Menu items and the Select, Combobox and Command lists (8, 10, 12, 12 and 12px), and Tabs triggers (6, 8, 8, 8 and 10px). Inset and checkbox or radio items move their labels with it, so they stay in line with items that have an icon. Everything else keeps its size.

  5. registry 0.10.0

    e03458c — New InputTime and InputTimeRange: segmented time fields over Reka UI's TimeField and TimeRangeField, in Input's five variants and five sizes, with 12- or 24-hour cycles, hour, minute or second granularity, step, min-value/max-value, loading and Field wiring. Inside an InputGroup they drop their own frame and take the group's variant and size.