import { TimePicker } from "@vortexlabs/vortex-native";
<TimePicker
mode="time"
variant="outline"
size="md"
disabled={false}
label="Appointment time"
/>Features
- Opens time or duration wheels in a bottom sheet.
- Limits selections to a range and a supported step.
- Formats the time with the locale’s clock convention.
- Confirms the selection when people tap Done.
Time of Day
In time mode, values are seconds from midnight in local time. Set hour12 to choose a 12-hour or 24-hour clock when the user has a preference. Otherwise the locale determines the format.
import { Stack, TimePicker } from "@vortexlabs/vortex-native";
export const ClockFormats = () => (
<Stack width={280} maxWidth="100%" gap={3}>
<TimePicker label="Pickup time" defaultValue={9 * 3600} locale="en-US" hour12 />
<TimePicker label="Return time" defaultValue={17 * 3600} locale="en-GB" hour12={false} />
</Stack>
);Range and Minute Steps
Pass min and max in seconds. Use minuteStep={5} or minuteStep={15} in time mode. The range must contain at least one selectable time at the chosen step.
import { Stack, TimePicker } from "@vortexlabs/vortex-native";
export const AppointmentWindow = () => (
<Stack width={280} maxWidth="100%">
<TimePicker
label="Appointment time"
min={9 * 3600}
max={17 * 3600}
initialValue={12 * 3600}
minuteStep={15}
/>
</Stack>
);Duration
Use mode="duration" for elapsed time. Set columns to show the units the task needs. All values are still in seconds.
import { Stack, TimePicker } from "@vortexlabs/vortex-native";
export const DurationPicker = () => (
<Stack width={280} maxWidth="100%">
<TimePicker
label="Break timer"
mode="duration"
columns="minutes-seconds"
min={30}
max={30 * 60}
defaultValue={5 * 60}
/>
</Stack>
);Controlled Selection
Pass value and update it in onChange. Done confirms the wheel selection. Dismissing the sheet discards changes and clearing the field returns null. An empty field starts the wheels at initialValue.
import { Stack, Text, TimePicker } from "@vortexlabs/vortex-native";
import React from "react";
export const ReminderTime = () => {
const [time, setTime] = React.useState<number | null>(null);
return (
<Stack width={280} maxWidth="100%" gap={2}>
<TimePicker
label="Reminder time"
value={time}
onChange={setTime}
initialValue={8 * 3600}
clearAriaLabel="Clear reminder time"
/>
<Text color="subtle">{time === null ? "No reminder scheduled" : "Reminder scheduled"}</Text>
</Stack>
);
};Sizes
Use sm in a compact layout or md for the standard field height.
import { Stack, TimePicker } from "@vortexlabs/vortex-native";
export const TimePickerSizes = () => (
<Stack width={280} maxWidth="100%" gap={3}>
<TimePicker label="Small" size="sm" />
<TimePicker label="Medium" size="md" />
</Stack>
);Variants
Use outline for a bordered field or fill for a filled surface.
import { Stack, TimePicker } from "@vortexlabs/vortex-native";
export const TimePickerVariants = () => (
<Stack width={280} maxWidth="100%" gap={3}>
<TimePicker label="Outline" variant="outline" />
<TimePicker label="Fill" variant="fill" />
</Stack>
);Disabled and Error States
Set disabled to prevent opening the sheet or clearing a value. Pass errorMessage to show a validation error below the field.
import { Stack, TimePicker } from "@vortexlabs/vortex-native";
export const TimePickerStates = () => (
<Stack width={280} maxWidth="100%" gap={3}>
<TimePicker label="Confirmed pickup" defaultValue={10 * 3600} disabled />
<TimePicker label="Return time" errorMessage="Choose a time after pickup." />
</Stack>
);Use WheelPicker to build a scrolling picker for values other than time.
Accessibility
label that identifies what people are choosing. It names the field and titles the sheet.clearAriaLabel to show and name the optional clear button.