Drivn vs shadcn/ui — Time Picker Compared
Drivn ships a first-party Time Picker; shadcn/ui has none. Compare the scrolling column picker, 12h/24h formats, and the native input fallback side by side.
Search the shadcn/ui registry for a time picker and you will not find one. shadcn ships a Date Picker recipe that puts a Calendar inside a Popover, then leaves time entry to you: a styled <input type="time">, a pair of Select dropdowns, or a block copied from elsewhere. Drivn ships the component. npx drivn add time-picker writes one TypeScript file to @/components/ui/time-picker, and that file holds both a scrolling column dropdown and a native-input variant behind the same props.
The dropdown is built on Drivn's own Popover, with the trigger, columns, and cells styled from one const styles object. The native variant, TimePicker.Input, renders through Drivn's Input. Nothing else comes along: no Radix, no cva, no date library, only React, cn(), and the Clock icon from lucide-react. Both variants read a Date from selected and hand a fresh Date to onSelect, so a form can swap one for the other without touching its state.
That makes this comparison less about whose implementation is better and more about how much you build. On shadcn you pick the parts, then wire 12-hour conversion, seconds, and scroll behaviour yourself and keep them in sync. On Drivn you start from a working picker and edit source you own. The sections below quote that source exactly as it appears in the registry.
Side-by-side comparison
| Feature | Drivn | shadcn/ui |
|---|---|---|
| First-party Time Picker | Yes — dedicated component | No — compose from Input/Select/Popover |
| Install command | npx drivn add time-picker | No registry item — build it yourself |
| Runtime UI dependencies | Own Popover + Input — zero npm UI packages | Radix Popover/Select if you compose one |
| Clock format | format prop — '12h' | '24h' | Build the toggle yourself |
| Seconds column | showSeconds prop | Build the column yourself |
| Scroll-to-selected | Yes — auto-centers on open | Build the scroll logic yourself |
| Native input fallback | TimePicker.Input — input type="time" | Use a plain Input type="time" |
| Styling pattern | Single const styles object | Inline cn() per composed element |
| Value type | Date object via selected / onSelect | Whatever your composition returns |
| License | MIT | MIT |
shadcn has no first-party Time Picker
The starting point of any honest comparison: there is no npx shadcn add time-picker. shadcn/ui ships a Date Picker recipe — Calendar inside a Popover — but time selection is left to you. The shadcn docs and community point you at three routes: a native <input type="time"> styled with the Input classes, a row of Select dropdowns for hours and minutes, or a third-party block you paste in. All three work, but all three are assembly, not installation.
Drivn closes that gap with a single command. npx drivn add time-picker installs a complete component under @/components/ui/time-picker that you then own and can edit. It is built on Drivn's Popover and Input, so it pulls in no new dependency you did not already have. The result is the usual Drivn trade flipped in Drivn's favour here: instead of choosing and wiring parts, you get a working picker on first install and edit from there.
1 import { TimePicker } from "@/components/ui/time-picker" 2 3 const [time, setTime] = React.useState<Date | undefined>() 4 5 <TimePicker 6 selected={time} 7 onSelect={setTime} 8 />
The scrolling column picker that auto-centers
The core of the Drivn Time Picker is its Column sub-component: a scrollable list of hour, minute, and (optionally) second values. The detail that makes it feel finished is the React.useEffect that scrolls the selected value into the centre of its column when the popover opens — it reads the [data-selected] element's offset and sets scrollTop so the active number sits mid-column rather than at the top. If you composed a time picker from shadcn Select dropdowns you would get a usable result, but not this scroll-to-selected behaviour without writing the same effect yourself.
Each cell is a button that pads its value with padStart(2, "0") and flips to the active styling — bg-foreground text-background — when it matches the current selection. This is verbatim from the Drivn registry; the whole column, scroll logic included, is a few lines you can read and re-style in place.
1 // packages/drivn/src/registry/components/time-picker.ts — verbatim 2 const ref = React.useRef<HTMLDivElement>(null) 3 React.useEffect(() => { 4 const col = ref.current 5 const el = col?.querySelector('[data-selected]') as HTMLElement | null 6 if (!col || !el) return 7 col.scrollTop = el.offsetTop - col.offsetTop - col.clientHeight / 2 + el.clientHeight / 2 8 }, [selected])
12h, 24h, and seconds from one prop each
Drivn's Time Picker handles the format permutations through props instead of separate components. The format prop takes '12h' or '24h' (default 24h); in 12h mode the root computes h12 = h % 12 || 12, derives the AM/PM period from h >= 12, and renders a period column with a to24 helper that maps the 12-hour value back to a 24-hour Date. The showSeconds prop adds a third scrolling column. The hours array itself is built inline from the format, so there is no branching component tree to maintain.
Reproducing this on a shadcn composition means wiring the 12h/24h toggle, the AM/PM state, and the seconds column by hand and keeping them in sync with a single Date. Drivn folds all of it into the one component you installed. The public API stays small — you flip a prop, not a sub-tree — which is the same defaults-driven approach you see across Drivn vs shadcn comparisons.
1 // packages/drivn/src/registry/components/time-picker.ts — verbatim 2 const is12 = format === '12h' 3 const h = selected?.getHours() 4 const period = h !== undefined ? (h >= 12 ? 'PM' : 'AM') : undefined 5 const h12 = h !== undefined ? (h % 12 || 12) : undefined 6 const hours = is12 ? Array.from({ length: 12 }, (_, i) => i + 1) : Array.from({ length: 24 }, (_, i) => i)
One file, two controls: dropdown or native field
Some fields do not need a styled dropdown. On a dense settings page or a mobile-first booking form, the browser's own <input type="time"> is quicker to use, and phones open their native time UI for it. On shadcn that is where you would start: a plain Input with type="time", plus your own conversion between its string value and whatever your form stores. Drivn ships that path in the same file as TimePicker.Input, so the conversion is already written.
The wrapper renders Drivn's Input with type="time", formats the selected Date as an HH:MM string, and parses each change back into a Date before calling onSelect. Clearing the field sends undefined. Every other native attribute passes through, so min, max, and step limit the field to business hours with no extra code. Because the dropdown and the input share the selected / onSelect contract, you can use the column picker on one screen and the native field on another without changing your state. The Time Picker examples page shows both in use.
1 // packages/drivn/src/registry/components/time-picker.ts — verbatim 2 function TimePickerInput({ 3 selected, 4 onSelect, 5 className, 6 ...props 7 }: Omit< 8 React.InputHTMLAttributes<HTMLInputElement>, 9 'type' | 'onChange' | 'value' | 'onSelect' 10 > & { 11 selected?: Date 12 onSelect?: (date: Date | undefined) => void 13 }) { 14 const value = selected ? String(selected.getHours()).padStart(2, '0') + ':' + String(selected.getMinutes()).padStart(2, '0') : '' 15 16 return ( 17 <Input 18 type="time" 19 value={value} 20 onChange={(e) => { 21 const v = (e.target as HTMLInputElement).value 22 if (!v) return onSelect?.(undefined) 23 const [h, m] = v.split(':').map(Number) 24 onSelect?.(new Date(0, 0, 0, h, m)) 25 }} 26 className={className} 27 {...props} 28 /> 29 ) 30 }
Install Drivn in one command
Copy the source into your project and own every line. Zero runtime dependencies, pure React + Tailwind.
npx drivn@latest createRequires Node 18+. Works with npm, pnpm, and yarn.
Frequently asked questions
No. shadcn/ui ships a Date Picker recipe built from Calendar and Popover, but it has no first-party Time Picker in its registry. For time selection you compose your own from a native input type="time", a set of Select dropdowns, or a community block. Drivn, by contrast, ships a dedicated Time Picker you install with npx drivn add time-picker.
Drivn's Time Picker is built on its own Popover and Input components plus React and the cn() helper — no Radix, no cva, and no date library. The trigger uses a Clock icon from lucide-react, and the dropdown renders scrolling hour, minute, and optional second columns inside the Popover content. Everything is held in one const styles object you can edit after install.
Through the format prop, which takes "12h" or "24h" and defaults to "24h". In 12h mode the component computes h12 as h % 12 || 12, derives the AM/PM period from whether the hour is 12 or more, and shows an AM/PM column. A to24 helper converts the chosen 12-hour value back into a 24-hour Date so onSelect always receives a real Date object.
Yes. Pass the showSeconds prop and a third scrolling column appears for seconds, alongside the hours and minutes. The values column is built from Array.from({ length: 60 }), so it covers 0 through 59. Without the prop the picker shows only hours and minutes, which is the right default for most scheduling and form use cases.
Yes — TimePicker.Input wraps the native input type="time" inside Drivn's Input component. It formats the selected Date into an HH:MM string and parses changes back into a Date on onSelect. Use it when you want the lightweight native picker, including the built-in mobile time UI, instead of the scrolling column dropdown.
Because the first install gives you a working scrolling column picker and a native-input variant, instead of Select dropdowns, AM/PM state, and scroll-to-selected logic you wire yourself. The source is still yours: if a design calls for a different hour range or layout, you edit the hours array or the Column component in place. Both variants return a plain Date, so the rest of your form code stays the same.