GitHub

Wheel Picker

A cylindrical drum picker with flick momentum, a bouncing detent, keyboard selection, and optional glass.

WheelPicker selects one value from an ordered list. Touch, mouse and pen drag the drum directly, rubber-banding past either end; a flick coasts on with momentum and settles on a row with a small bounce. A mouse wheel or trackpad spins it continuously and snaps once it goes idle. The centre row is a crisp copy of the drum clipped to the selection band, so labels sharpen exactly as they cross it, without a duplicate accessible list.

Loading example…

Installation

pnpm dlx shadcn@latest add draco-china/sui/wheel-picker

Load SUI's base styles as described in Installation. Default light/dark colors are included; other palettes are optional.

Usage

import { WheelPicker } from "@workspace/ui/components/wheel-picker";

<WheelPicker
  aria-label="Duration in minutes"
  options={["15", "30", "45", "60"]}
  defaultValue="30"
  name="duration_minutes"
/>;

Options can be strings or { label, value } objects. Values must be unique. Use value and onValueChange for controlled selection. The parent owns the selected value and can reject a request; uncontrolled selection uses defaultValue. An absent or missing value displays the first option. Changing the available options clamps the displayed selection without emitting a user change.

Compose columns

Combine independently labelled wheels inside a named group. Application code owns date validity, dependent columns, formatting, and persistence.

Loading example…

Keyboard and accessibility

The wheel is a single focusable listbox with aria-activedescendant and selected options. Supply a localized aria-label or aria-labelledby. Arrow Up/Down selects the previous/next value; Home/End reaches the boundaries, and Page Up/Down moves by one visible page. Selection stops at either end.

With reduced motion, the same list and controls remain available as a flat list that moves in place, without cylinder rotation or animated settling. disabled and empty options remove the wheel from the Tab sequence and prevent changes. name submits the selected value through a hidden input; native form reset restores an uncontrolled default. Tick sound follows feedback and is off by default; set feedback="sound" or enable sound on FeedbackProvider. Like the beUI reference, it uses a locally synthesized 16ms mechanical click whenever the nearest row changes while dragging, spinning, or coasting; settling on the same row does not play it again. Keyboard and direct selection also tick once. Audio is prepared at the start of a user gesture, shares one context and buffer across columns, and cuts the previous tick tail during rapid movement. Initial rendering, form reset, and external value updates stay silent. Audio failures never block selection.

Loading example…

Material

The default is a solid working control using SUI semantic colors and 14px text. glass or frosted applies the shared material to its frame; individual rows stay ordinary. Keyboard focus remains visible. The drum owns its gestures, so dragging or spinning it never scrolls the page behind it.

API reference

PropTypeDefault / behavior
optionsreadonly WheelPickerOption[]Required; unique values.
value, defaultValuestringControlled value or initial uncontrolled value.
onValueChange(value: string) => voidCalled for a user selection.
visibleCountnumber7; normalized to an odd count from 3 to 11. The wheel is as tall as the drum's projection; reduced motion gives every row a full slot.
itemHeightnumber36 pixels; minimum 24.
disabledbooleanfalse.
feedbackFeedbackOptionFollows FeedbackProvider; selection haptic and tick per row crossed.
namestringOptional form field name.
glass, frostedboolean | GlassConfig, booleanOrdinary by default.
Other propsNative div propsIncludes labels, ref, className, style, and event handlers.

Exports WheelPicker, WheelPickerProps, and WheelPickerOption. The interaction references beUI Wheel Picker; this SUI implementation drives the drum with Motion.