Skip to content
Haze UI

Wheel picker

A flat scroll-snap column for choosing one value from a short ordered list, with a centered selection band and a hidden input for the form.

pnpm dlx shadcn@latest add @haze/wheel-picker
Open preview in a new tab
Livesmall script

When to use

  • A short ordered list such as hours, minutes, a quantity or a size is chosen by scrolling, mostly on touch.
  • Several columns sit side by side to compose one value, for example hours and minutes.

When not to use

  • Use select or combobox when the list is long or needs searching.
  • Use number-field or stepper when the value is typed or stepped numerically.
  • Use time-picker when a native time input with min and max is enough.

Installation

Add the Haze registry to components.json once, then install Wheel picker with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/wheel-picker
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
id*string–Unique id of the listbox; option ids are derived from it.
namestringidName of the hidden input that submits the selected value.
label*string–Visible label above the column, also the accessible name.
options(string | { value: string; label?: string })[]["1" ... "10"]Ordered options; a string is both value and label.
valuestring–Value selected on first render; the first option when missing.
rowsnumber5Visible rows, an odd number of at least 3.
disabledbooleanfalseRemoves the column from the tab order and from form submission.
classstring–Additional classes on this component's outer wrapper.
[key: string]unknown–Additional attributes on the listbox, for example aria-describedby.

Keyboard interactions

ArrowUpArrowDown
Move the selection by one option.
PageUpPageDown
Move the selection by a page of options.
HomeEnd
Select the first or last option.
Digits or letters
Jump to the first option whose label starts with what was typed.

Accessibility

  • The column is a role=listbox with role=option rows and aria-activedescendant, so it is one tab stop and the selection follows the scroll position. Native radios would add one tab stop per row and could not follow scrolling.
  • The selected value is announced politely after scrolling settles and submitted through a hidden input; a change event bubbles from it.
  • Rows further from the center fade and shrink through a script that reads the scroll position; reduced motion removes the fade, the scale and smooth scrolling.
  • Pointer and touch use native scrolling with scroll-snap, and a click on a row selects it.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Wheel picker" with `npx shadcn@latest add @haze/wheel-picker`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import WheelPicker from "@/components/haze/ui/wheel-picker.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/wheel-picker.md

  • Customize with real content

    Adapt the Haze wheel-picker ui for our product. Replace the demo values of these props with our real content: id, name, label, options, value, rows, disabled, class, [key: string]. Keep the layout, the heading level rules and these accessibility details: The column is a role=listbox with role=option rows and aria-activedescendant, so it is one tab stop and the selection follows the scroll position. Native radios would add one tab stop per row and could not follow scrolling. The selected value is announced politely after scrolling settles and submitted through a hidden input; a change event bubbles from it. Rows further from the center fade and shrink through a script that reads the scroll position; reduced motion removes the fade, the scale and smooth scrolling. Pointer and touch use native scrolling with scroll-snap, and a click on a row selects it. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using wheel-picker, check it fits: use it when a short ordered list such as hours, minutes, a quantity or a size is chosen by scrolling, mostly on touch.; several columns sit side by side to compose one value, for example hours and minutes.. Avoid it when use select or combobox when the list is long or needs searching.; use number-field or stepper when the value is typed or stepped numerically.; use time-picker when a native time input with min and max is enough.. Alternatives: @haze/time-picker, @haze/select, @haze/number-field, @haze/stepper.

Dependencies

  • npm: @lucide/astro
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog