Skip to content
Drivn logoDrivn

Time Picker

Time picker with scrollable dropdown columns and native input mode.

Preview

Hr
Min
Sec

Installation

npx drivn add time-picker

Usage

Import TimePicker and manage selection with useState.

1import { TimePicker } from "@/components/ui/time-picker"
2
3const [time, setTime] = React.useState<Date | undefined>()
4
5<TimePicker
6 selected={time}
7 onSelect={setTime}
8/>

12-Hour Format

Switch to 12-hour clock with AM/PM selection.

Hr
Min

With Seconds

Show a seconds column alongside hours and minutes.

Hr
Min
Sec

Custom Format

Pass a formatTime function to control the display text.

Hr
Min
Drivn Feature

Input Mode

Use TimePicker.Input for a native time input with Drivn styling.

Disabled

Both modes support the disabled state.

Hr
Min

API Reference

TimePicker

PropTypeDefaultDescription
selectedDate | undefinedThe currently selected time as a Date object
onSelect(date: Date | undefined) => voidCallback when a time is selected
format'12h' | '24h''24h'Clock format — 12-hour with AM/PM or 24-hour
showSecondsbooleanfalseShow seconds column in the dropdown
placeholderstring"Pick a time"Text shown when no time is selected
formatTime(date: Date) => stringtoLocaleTimeStringCustom time formatting function
disabledbooleanfalseDisable the time picker trigger
classNamestringAdditional CSS classes for the root wrapper

TimePicker.Input

PropTypeDefaultDescription
selectedDate | undefinedThe currently selected time as a Date object
onSelect(date: Date | undefined) => voidCallback when a time is selected
minstringMinimum allowed time (e.g. "09:00")
maxstringMaximum allowed time (e.g. "17:00")
stepnumberStep interval in seconds (e.g. 900 for 15 minutes)
disabledbooleanfalseDisable the input
classNamestringAdditional CSS classes