Skip to content
GitHub (opens in a new tab)

TimePicker

Pick a time of day as hour and minute, in 12-hour or 24-hour form.

stableMoleculecontracts/timepicker.json

Preview

TimePicker

Hour and minute. Arrow keys change the focused part. 12-hour mode has an AM/PM button. The value is always HH:mm.

Master

A date and a time together is DateTimePicker. A day only is DatePicker.

Usage

Wrap with Field. Focus the hour or the minute, then ArrowUp and ArrowDown. Do not use a native time input.

Do's

  • A time in a form, without a date
  • Arrow keys should move the hour or the minute

Don'ts

<Field label="Start time" htmlFor="start"><TimePicker id="start" hourCycle="12" /></Field>

When to use

  • A time in a form, without a date
  • Arrow keys should move the hour or the minute

When not to use

  • A date and a time together — use DateTimePicker
  • A date only — use DatePicker

What an agent reads

import { TimePicker } from "agentic-ds-kit";
must
  • The field is a group. Hour and minute are spinbuttons
  • ArrowUp and ArrowDown change the focused part
  • In 12-hour mode, a button switches AM and PM and is labelled Period
  • The submitted value is HH:mm
  • Must have a Field label or ariaLabel
  • built-in labels (hour, minute, period) come from KitLabelsProvider; English by default
defaults
  • size md
  • hourCycle 12
  • disabled false
  • error false
stops if
  • Do not use input type=time
  • Do not store 12-hour text — the value is HH:mm
  • Do not use raw hex

From contracts/timepicker.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
idstringYes——
sizemd | smNomd—
valuestringNo—Controlled HH:mm in 24-hour form.
defaultValuestringNo——
onValueChangefunctionNo—(value: string) => void
hourCycle12 | 24No12—
disabledbooleanNofalse—
errorbooleanNofalse—
namestringNo——
describedBystringNo——
ariaLabelstringNo——
  • Component
    →

    DateTimePicker

    Pick a calendar date and a time in one field.

  • Component
    →

    DatePicker

    Form field that opens a month grid to pick one date.