Time field
A compact field that takes what people type, with the time picker a press away.
import { TimeField } from '@windmorph/react';Keyboard
| Key | Action |
|---|---|
| Tab | Moves to the field, then its clock button. |
| Enter | Normalizes what’s typed; on the clock, opens the picker. |
| ↑ or ↓ or Home or End or Page Up or Page Down | In a docked list, move between the times; a digit jumps to a time starting with it. |
| Enter or Space | In a docked list, pick the time and close the list. |
| Esc | Closes 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
textboxand abutton, opening adialogwith the time picker, or docked alistboxof times asoptions, the field’s one selected. - Accessible name
- The field from
label, and the button fromlabels. - 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
minandmaxwhere only some times are valid, and show why inerrorMessage.