Skip to component
GGamma

Option Wheel

A curved picker that turns a short option set into a tactile wheel controlled by scroll, drag, or arrow keys.

New
Finish lab

Scroll, drag, or use arrow keys

FoilingA warm metallic hit on the finished sheet.
Live previewUse keyboard to interact

Implementation

1"use client";2 3import {4  useEffect,5  useId,6  useRef,7  useState,8  type CSSProperties,9  type HTMLAttributes,10  type KeyboardEvent,11  type PointerEvent,12} from "react";13 14export type OptionWheelProps = Omit<15  HTMLAttributes<HTMLDivElement>,16  "children" | "onChange" | "defaultValue"17> & {18  /** Labels rendered as wheel options. */19  items: readonly string[];20  /** Accessible name for the option group. */21  label?: string;22  /** Controlled selected index. */23  value?: number;24  /** Initial selected index when uncontrolled. */25  defaultValue?: number;26  /** Called when the wheel settles on a new option. */27  onValueChange?: (index: number, item: string) => void;28  /** Wrap from the last option to the first. */