Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Forms

TimePicker

Free25.0 KB gzipped

A time field: type a time in almost any form ("2:30 pm", "1430", "230p", "14h30", the locale's own format), or pick one from a list of times step minutes apart. Built on Combobox, so the list follows the WAI-ARIA combobox pattern: ArrowDown opens it on the selected time, arrows move, Enter picks, Escape closes, and typing filters it.

Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · Keys: Arrow Down, Arrow Up, Enter and 1 more · Full report

Import

tsx
import { TimePicker } from "@vjdesigns/vjdesigns-ui";

Importing only TimePicker adds about 25.0 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.

Examples

Basic

Type a time in almost any form ("2:30 pm", "1430", "230p"), or press Arrow Down to pick from times step minutes apart. The value is a 24-hour "HH:mm" string; the field shows the locale's clock.

Example: 2:30 PM

Between 8:00 AM and 10:00 PM.

tsx
import { Field, TimePicker } from "@vjdesigns/vjdesigns-ui";

export function Basic() {
  return (
    <Field label="Tip-off" hint="Between 8:00 AM and 10:00 PM." style={{ width: "100%", maxWidth: "16rem" }}>
      <TimePicker name="tipoff" min="08:00" max="22:00" step={15} />
    </Field>
  );
}

Twenty four hour

hourCycle={24} shows a 24-hour clock whatever the locale. clearable adds a clear button.

Example: 14:30
tsx
import { Field, TimePicker } from "@vjdesigns/vjdesigns-ui";

export function TwentyFourHour() {
  return (
    <Field label="Practice starts" style={{ width: "100%", maxWidth: "16rem" }}>
      <TimePicker name="practice" hourCycle={24} defaultValue="18:30" clearable />
    </Field>
  );
}

Right to left

The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.

Basic

مثال: 2:30 م

Between 8:00 AM and 10:00 PM.

tsx
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";

// Basic is the "Basic" example above.
<LocaleProvider locale="ar" messages={ar}>
  <Basic />
</LocaleProvider>

Usage notes

The value is a 24-hour "HH:mm" string, the same as a native <input type="time">, so it never shifts with time zones. The field shows it in the locale's clock (12- or 24-hour, override with hourCycle). On blur (or Enter), typed text is parsed and normalized, or rejected with an inline, announced error. Inside a Field, label, hint, error, required, disabled, and invalid state are wired to the input.

tsx
<Field label="Tip-off">
  <TimePicker name="tipoff" min="08:00" max="22:00" step={15} />
</Field>

API reference

TimePicker

New in 1.5.0
TimePicker props
PropTypeDefault
value

Selected time, "HH:mm" (24-hour), or null for none (controlled).

ISOTime | null—
defaultValue

Initially selected time when uncontrolled.

ISOTime | null—
onValueChange

Called with the new time ("HH:mm") or null when the user picks one from the list, types one and leaves the field, or clears it. Typed text that isn't a valid, allowed time sets the value to null.

(value: ISOTime | null) => void—
min

Earliest allowed time, "HH:mm". Also where the list starts.

ISOTime—
max

Latest allowed time, "HH:mm". Also where the list ends.

ISOTime—
step

Minutes between the times in the list. Any minute can still be typed.

number30
hourCycle

12-hour (AM/PM) or 24-hour clock. Defaults to the locale's.

1224—
locale

BCP 47 locale for formatting and parsing. Defaults to the LocaleProvider locale.

string—
size

Field height and type size. Inherits from a surrounding Field.

"sm""md""lg""md"
name

Name of a hidden input that submits the value ("HH:mm") with a form.

string—
clearable

Shows a clear button while there is text.

booleanfalse
placeholder

Placeholder text. Defaults to none: the format is described to screen readers instead.

string—
invalid

Danger styling and aria-invalid. Inherits from a surrounding Field.

boolean—
required

Requires a value. Inherits from a surrounding Field.

boolean—
disabled

Disables the field. Inherits from a surrounding Field.

boolean—
readOnly

Shows the value without allowing changes. Inherits from a surrounding Field.

boolean—
placement

Preferred side of the list. Flips when there isn't room.

"top""top-start""top-end""bottom""bottom-start""bottom-end""left""left-start""left-end""right""right-start""right-end""bottom-start"
maxHeight

Maximum list height (CSS length, or px as a number).

CSSProperties["maxHeight"]16rem
fullWidth

Stretches the field to fill its container.

booleantrue
onInvalidInput

Called when the user leaves the field with text that isn't a valid, allowed time. Use it to set your own Field error.

(error: TimeInputError) => void—
invalidMessage

Message shown under the field when typed text is rejected. Pass a function to word it per reason, or null to show none (when you show a Field error from onInvalidInput instead).

ReactNode | ((error: TimeInputError) => ReactNode)—
formatDescription

Screen-reader description of the expected format.

(example: string) => string(example) => `Example: ${example}`
showTimesLabel

Accessible name of the list button while closed.

string"Show times"
hideTimesLabel

Accessible name of the list button while open.

string"Hide times"
id

Id for the text input. Inside a Field, the Field's id is used.

string—
aria-label

Accessible name, when there is no visible label (Field).

string—
aria-labelledby

Ids of elements that name the field.

string—
aria-describedby

Ids of elements that describe the field.

string—
className

Class name for the outer root.

string—
style

Style for the outer root.

CSSProperties—
ref

Ref to the text input.

Ref<HTMLInputElement>—
onBlur

Called when the text input loses focus (after the typed text is committed).

(event: FocusEvent<HTMLInputElement>) => void—

See what changed in each version in the Changelog.

Accessibility report

TimePicker targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.

axe-core audit (live)

Running accessibility audit

Checking the examples above…

Lighthouse audit

Light mode

Score 100

37 passed · 0 failed · 28 not applicable · 10 to check by hand

Dark mode

Score 100

37 passed · 0 failed · 28 not applicable · 10 to check by hand

Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.

Built-in behavior

Keyboard

Keyboard
KeyAction
TypingEnter a time in almost any form ("2:30 pm", "1430", "230p"); it filters the list.
Arrow DownOpens the list on the selected time, or moves to the next time.
Arrow UpPrevious time.
EnterPicks the highlighted time, or applies the typed one.
EscapeCloses the list.

Built on Combobox: focus stays in the field. Typed text is checked on blur or Enter; an invalid time shows an inline, announced error.

Roles and states

Roles and states
ElementRoleStates and properties
<input>comboboxaria-expanded, aria-controls → listbox, aria-activedescendant, aria-invalid, aria-describedby → hint and error
Timeslistbox / optionaria-selected
ErroralertAnnounced when typed text can't be read as a time

Manual checks

Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.

Manual accessibility checks
CheckWhat to testWCAG 2.2
KeyboardEvery action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck.2.1.1 (A), 2.1.2 (A)
FocusFocus moves in a logical order, is always visible, and isn't hidden behind sticky headers.2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA)
Screen readersNames, roles and states are announced correctly, and status changes are announced without moving focus.1.3.1 (A), 4.1.2 (A), 4.1.3 (AA)
ColorMeaning never depends on color alone; your own colors meet contrast in both modes.1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA)
Zoom and reflowAt 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed.1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA)
Pointer targetsClick and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap.2.5.8 (AA), 2.5.5 (AAA)
MotionAnimations respect the reduced-motion setting.2.3.3 (AAA)