WheelPicker

Drag or flick and it coasts, then snaps. Rows tilt and fade away from the center. Inputs.

Open playground
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December

About

WheelPicker is a React component in the Inputs category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { WheelPicker } from "@ashutoshswamy/smoui" and set items, defaultIndex, onChange among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { WheelPicker } from "@ashutoshswamy/smoui";

<WheelPicker label="Month" items={["January", "February", "March"]} onChange={(i, v) => setMonth(v)} />

Props 5

items

Rows.

string[]
defaultIndex

Initial row.

numberdefault 0
onChange

Called as the selection passes a row.

(index: number, value: string) => void
itemHeight

Row height in px.

numberdefault 42
label

Accessible name. Arrow keys and the mouse wheel work.

string