Components Forms
TimePicker
StableEnter a time of day with keyboard-friendly hour and minute segments.
TimePicker uses separate spinbutton segments, the same model as the native time input: type digits (focus advances automatically) or use the arrow keys. The value is always 24-hour HH:MM (or HH:MM:SS) regardless of display, so it is easy to store and submit. The hour cycle follows the locale unless set.
Overview
Europe/London
import { FormField, TimePicker } from '@bindshq/stance-react';
export function Basic() {
return (
<FormField label="Send daily digest at" description="Europe/London" style={{ width: 220 }}>
<TimePicker hourCycle={24} defaultValue="09:00" name="digestTime" />
</FormField>
);
}Light, dark and high contrast
Every Stance component is designed and tested in all three appearance modes.
Europe/London
Europe/London
Europe/London
Import
import { TimePicker } from '@bindshq/stance-react';Platforms
TimePicker has native counterparts. They share Stance tokens and intent, and use each platform’s own controls and conventions. The live previews on this page are the web implementation.
import { TimePicker } from '@bindshq/stance-react';Examples
Stored value: 16:30
import { useState } from 'react';
import { FormField, TimePicker } from '@bindshq/stance-react';
export function TwelveHour() {
const [time, setTime] = useState<string | null>('16:30');
return (
<div style={{ display: 'grid', gap: 8, width: 220 }}>
<FormField label="Meeting starts">
<TimePicker hourCycle={12} value={time} onValueChange={setTime} />
</FormField>
<p style={{ margin: 0, fontSize: 13 }}>Stored value: {time ?? 'None'}</p>
</div>
);
}Quarter-hour steps
Arrow keys move minutes in 15-minute increments.
import { FormField, TimePicker } from '@bindshq/stance-react';
export function Step() {
return (
<FormField label="Deployment slot" style={{ width: 220 }}>
<TimePicker hourCycle={24} step={15} defaultValue="14:00" />
</FormField>
);
}import { TimePicker } from '@bindshq/stance-react';
export function WithSeconds() {
return (
<div style={{ display: 'grid', gap: 12, width: 240 }}>
<TimePicker
aria-label="Sync time"
hourCycle={24}
showSeconds
clearable
defaultValue="06:00:30"
/>
<TimePicker aria-label="Locked" hourCycle={24} disabled defaultValue="12:00" />
</div>
);
}API reference
| Prop | Type | Default | Description |
|---|---|---|---|
value / defaultValue | string | null | None | 24-hour `HH:MM` or `HH:MM:SS`; null while incomplete. |
onValueChange | (value: string | null) => void | None | Called when the time changes. |
hourCycle | 12 | 24 | locale | Display cycle. |
locale | string | None | Used to pick the default hour cycle. |
step | number | 1 | Minute increment for arrow keys. |
showSeconds | boolean | false | Adds a seconds segment. |
name | string | None | Hidden input name for form submission. |
clearable | boolean | false | Show a clear button. |
size | 'sm' | 'md' | 'lg' | 'md' | Field height. |
disabled / required / invalid | boolean | None | States, also inherited from FormField. |
labels | Partial<TimePickerLabels> | None | Segment names and AM/PM text. |
Accessibility
- A group named by its FormField label, containing spinbuttons named Hours, Minutes (Seconds) and AM/PM.
- Each spinbutton exposes aria-valuenow, min, max and a text value; empty segments announce “Empty”.
- Each segment is a tab stop, matching native time inputs.
Keyboard
| Keys | Action |
|---|---|
| ↑ ↓ | Increment / decrement the segment (wraps). |
| 0 to 9 | Type a value; focus advances when the segment is complete. |
| ← → | Move between segments. |
| Home End | Minimum / maximum value. |
| Backspace | Clear the segment. |
| A P | Set AM / PM. |
Usage guidelines
Do
- State the time zone in the description.
- Use step for scheduling in fixed slots.
Don’t
- Use for durations; use NumberInput.