Skip to Content

SpinnerWheel

Prize/fortune spinner wheel with configurable segments and spin animation.

Props

PropTypeDefaultDescription
segmentsSpinnerSegment[]Wheel segments (see below)
durationnumber4000Spin animation duration in ms
rotationsnumber3Number of full rotations before landing
mode'trigger' | 'continuous''trigger''trigger' = spin on demand; 'continuous' = spins on mount, call spin() to land
onComplete(segment: SpinnerSegment) => voidCalled when the wheel lands on a segment
pointerColorstring#22c55ePointer / center accent color
strokeColorstring#ffffffSegment border color
strokeWidthnumber2Segment border width
centerRadiusnumber14Center circle radius
centerColorstring#ffffffCenter circle color
classNamestringContainer className
styleCSSPropertiesContainer style

SpinnerSegment

PropertyTypeDescription
idstringUnique segment identifier
labelstringDisplay label on the wheel
valuestringValue returned on completion
colorstringSegment background color
textColorstringLabel text color (auto-detected from background if omitted)
itemReactNodeCustom content to render instead of the text label

Ref Handle

MethodDescription
spin(targetIndex?)Spin the wheel. Lands on targetIndex if provided, otherwise random.

Example

const wheelRef = useRef<SpinnerWheelHandle>(null) <SpinnerWheel ref={wheelRef} segments={[ { id: '1', label: '10% OFF', value: '10', color: '#FF6B6B' }, { id: '2', label: '25% OFF', value: '25', color: '#4ECDC4' }, { id: '3', label: '50% OFF', value: '50', color: '#45B7D1' }, ]} onComplete={(segment) => alert(`You won ${segment.label}!`)} /> <button onClick={() => wheelRef.current?.spin()}>Spin</button>
Last updated on