Examples
Native time control
Use a native time control and receive a 24-hour string value.
Meeting time control
import { TimePicker } from "@phuctech/ui/components/time-picker";
export function Example() {
return <TimePicker aria-label="Meeting time" defaultValue="09:30" />;
}
Include seconds
Enable second-level precision when the task needs it.
Time control with seconds
import { TimePicker } from "@phuctech/ui/components/time-picker";
export function Example() {
return <TimePicker aria-label="Job start time" defaultValue="09:30:00" showSeconds />;
}
Try the props
Edit the time and toggle second-level precision.
TimePicker property playground
import { TimePicker } from "@phuctech/ui/components/time-picker";
export function Example() {
return <TimePicker aria-label="Reminder time" defaultValue="14:30" />;
}When to use
Use TimePicker for a local time-of-day value. Its value is a string in HH:mm form, or HH:mm:ss when seconds are enabled. It wraps the native input[type=time] so browser keyboard and locale behavior remain available.
Usage
import { TimePicker } from "@phuctech/ui/components/time-picker";
<TimePicker aria-label="Meeting time" defaultValue="09:30" minuteStep={15} />API
Tokens
Accessibility
The underlying native input keeps browser keyboard behavior and form semantics. Supply a visible Field label or an accessible name; min, max, step, disabled, readOnly, and required are forwarded to the input.
Do and don’t
Store the time string and combine it with a date only in the feature that owns that domain value.
Assume a time-of-day value includes a date or an offset from UTC.
Related
- DatePicker selects a calendar date or range.
- Input provides other native text input types.
- Field adds visible labels and validation context.