Wheel pickerPro
iOS-style scroll wheel with 3D rows, snapping and keyboard support.
Alarm set for 9:30 AM
When to use
- Picking times, dates and quantities on touch screens.
- Short ordered lists where scrolling feels natural.
When not to use
- Long lists people search: use a combobox.
- Desktop forms where typing is faster.
Installation
Usage
Import it from @/components/ui/wheel-picker after installing.
example.tsx
import * as React from "react";
import { WheelPicker } from "@/components/ui/wheel-picker";
const hours = Array.from({ length: 12 }, (_, i) => ({ value: String(i + 1), label: String(i + 1) }));
export function HourPicker() {
const [hour, setHour] = React.useState("9");
return <WheelPicker aria-label="Hour" options={hours} value={hour} onValueChange={setHour} />;
}API reference
WheelPicker
A snapping scroll list drawn as a 3D wheel; the centered row is the value.
| Prop | Type | Default | Description |
|---|---|---|---|
| options | readonly { value: T; label: string }[] | – | Rows in order. |
| value / defaultValue / onValueChange | T | – | Controlled or uncontrolled; fires after scrolling settles. |
| itemHeight / visibleCount | number | 36 / 5 | Row height and rows shown (odd). |
| aria-label | string | – | Required: names the wheel. |
Keyboard interactions
| Keys | Action |
|---|---|
| ↑or↓ | Previous or next option |
| Page UporPage Down | Five at a time |
| HomeorEnd | First or last |
Accessibility
- A listbox using aria-activedescendant; the centered option is aria-selected.
- Each wheel needs its own label (Hour, Minute…).
Motion
- Rows tilt and fade with distance from the center; scroll snapping settles each flick; keys scroll smoothly.
Responsive behavior
- Native scrolling, so flicks feel right on touch; combine several wheels in a flex row.
Performance
- Transforms are recalculated from scroll position; fine for lists up to a few hundred rows.
Notes for AI
- onValueChange fires after scrolling stops (110ms), not on every row passed.
This page as Markdown, for assistants and coding agents:
/components/wheel-picker/markdownThe full library index for assistants is at /llms.txt.
Lode222 doc pagesllms.txt