TimePicker
A pressable field that opens a bottom sheet with hour/minute steppers and an AM/PM toggle. Fully controlled via value ({ hour, minute } in 24-hour form) and onChange.
Playgroundβ
Time
<TimePicker
label="Time"
minuteStep={5}
value={value}
onChange={setValue}
/>
Basic usageβ
Reminder time
function TimePickerDemo() {
const [value, setValue] = useState<{ hour: number; minute: number } | undefined>(undefined);
return <TimePicker label="Reminder time" value={value} onChange={setValue} />;
}
Minute stepβ
Meeting start
<TimePicker label="Meeting start" value={value} onChange={setValue} minuteStep={15} />
Propsβ
| Prop | Type | Default | Description |
|---|---|---|---|
value | { hour: number; minute: number } | Currently selected time, 24-hour hour (0β23). | |
onChange | (value: { hour: number; minute: number }) => void | Required. Called when the hour, minute, or AM/PM changes. | |
minuteStep | number | 1 | Minute increment the stepper moves by. |
placeholder | string | 'Select a timeβ¦' | Text shown when nothing is selected. |
label | string | Label rendered above the field. | |
errorText | string | Helper text shown below the field when isInvalid. | |
isInvalid | boolean | false | Renders the field with an error border and shows errorText. |
isDisabled | boolean | false | Disables interaction and dims opacity. |
formatValue | (value) => string | "1:30 PM" format | Formats the selected time for the trigger field. |
buttonBg | TVajraColors | Background color for the stepper +/β buttons. | |
buttonColor | TVajraColors | Icon color for the stepper +/β buttons. | |
icon | TVajraIconComponent | Icon shown at the trailing edge of the trigger. Defaults to a plain π glyph. | |
testID | string | Test identifier. |
Exports formatTime, timeFromDate, and timeToDate helpers for converting between { hour, minute } and Date.