Pro unlocks unlimited templates48:00:00Get Pro →

Wheel Picker

An iOS-style scroll wheel for choosing options, times, and dates. Installs under components/wheel-picker, not under ui/.

Basic

Pick a single value from a scrollable wheel.

Loading…

Installation

CLI
npx @sonojs/ui@latest add wheel-picker
Also needs
npm i @ncdai/react-wheel-picker@^1.2.3

Composition

structure
WheelPickerWrapper
└── WheelPicker

Usage

wheel-picker.tsx
"use client"

import * as React from "react"

import {
  WheelPicker,
  WheelPickerWrapper,
  type WheelPickerOption,
} from "@/components/wheel-picker"

const options: WheelPickerOption[] = [
  { label: "React", value: "react" },
  { label: "Vue", value: "vue" },
  { label: "Svelte", value: "svelte" },
]

export function Example() {
  const [value, setValue] = React.useState("react")

  return (
    <WheelPickerWrapper>
      <WheelPicker options={options} value={value} onValueChange={setValue} />
    </WheelPickerWrapper>
  )
}
PropTypeDefaultDescription
optionsWheelPickerOption[]-Items in the wheel (`label`, `value`, optional `disabled`).
valuestring · number-Controlled selected value.
defaultValuestring · number-Uncontrolled initial value.
onValueChange(value: string · number) => void-Fires when the selection changes.
infinitebooleanfalseLoop the column endlessly.
visibleCountnumber20Visible rows (must be a multiple of 4).
classNamesWheelPickerClassNames-Classes for option items, highlight wrapper, and highlight item.