Wheel Picker

iOS-like wheel picker for Svelte with smooth inertia scrolling and infinite loop support.

runed

Installation

pnpm dlx shadcn-svelte@latest add http://sveltekit-prerender/r/wheel-picker.json

Usage

usage.svelte

Features

  • Natural touch scrolling with smooth inertia, mouse drag and scroll for desktop
  • Infinite loop scrolling
  • Unstyled core for complete style customization
  • Full keyboard navigation and type-ahead search

Examples

Time picker

Combine three wheel pickers to select an hour, minute, and meridiem.

Props

WheelPicker

Keyboard, pointer, touch, and wheel-controlled option picker.

NameTypeDefaultDescription
optionsWheelPickerOption<T>[]requiredValues, labels, and disabled states available for selection.
valueTundefinedBindable selected value.
defaultValueTundefinedInitial selection when value is undefined.
onValueChange(value: T) => voidundefinedCalled whenever interaction selects a different value.
infinitebooleanfalseRepeats options to allow continuous looping.
visibleCountnumber20Number of wheel positions; must be a positive multiple of four.
dragSensitivitynumber3Multiplier applied to pointer and touch dragging.
scrollSensitivitynumber5Multiplier applied to wheel scrolling.
optionItemHeightnumber30Height of each option row in pixels.
classesWheelPickerClassesundefinedClass overrides for optionItem, highlightWrapper, and highlightItem.
refHTMLDivElement | nullnullBindable reference to the picker element.

WheelPickerWrapper

Styled group container for one or more wheel pickers.

NameTypeDefaultDescription
childrenSnippetrequiredWheelPicker components rendered inside the group.
classstringundefinedAdditional classes applied to the wrapper.
refHTMLDivElement | nullnullBindable reference to the wrapper element.