Skip to content

Time field

A compact field that takes what people type, with the time picker a press away.

import { TimeField } from '@windmorph/react';

Keyboard

Time field keyboard
KeyAction
TabMoves to the field, then its clock button.
EnterNormalizes what’s typed; on the clock, opens the picker.
↑ or ↓ or Home or End or Page Up or Page DownIn a docked list, move between the times; a digit jumps to a time starting with it.
Enter or SpaceIn a docked list, pick the time and close the list.
EscCloses the picker or the list and changes nothing.

The mobile keyboard is numeric on a 24-hour clock and full on a 12-hour one, which needs letters for “pm”.

Screen reader

Role
A textbox and a button, opening a dialog with the time picker, or docked a listbox of times as options, the field’s one selected.
Accessible name
The field from label, and the button from labels.
States announced
Invalid, required, read only or disabled, as set.

An error is linked to the field, and the format shows as its placeholder.

Focus

  • After a keyboard or mouse press on the clock, focus returns to the text box. After a touch it returns to the clock button, so the on-screen keyboard doesn’t rise.
  • A docked list takes focus as it opens, on the field’s time, or with none on the time nearest now; only the list scrolls to it, never the page.

Touch target

  • The field is 56px tall at density 0 and loses 4px a density step, as the core’s fields do.
  • The clock is an icon button, with the core’s touch target.

Motion

  • The picker follows the core’s dialog, which only fades under reduced motion.
  • The docked list opens as a menu does, and only fades under reduced motion.

What you need to do

  • Give it a label.
  • Set min and max where only some times are valid, and show why in errorMessage.