New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@wheelfor/wheel-picker

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wheelfor/wheel-picker

Canvas-based spinning wheel picker with themes, smooth animations, and spin events. Zero runtime dependencies.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

@wheelfor/wheel-picker

A lightweight, canvas-based spinning wheel picker with smooth animations, 8 built-in color themes, and a simple event-driven API. Zero runtime dependencies — everything is bundled.

Live demo → wheelfor.com

Installation

npm install @wheelfor/wheel-picker

Usage

<canvas id="wheel" width="500" height="500"></canvas>
import { WheelPicker } from '@wheelfor/wheel-picker';

const canvas = document.getElementById('wheel');

const wheel = new WheelPicker(canvas, {
  choices: ['Pizza', 'Sushi', 'Tacos', 'Burgers', 'Salad'],
  theme: 'Fresh Air',
});

wheel.addEventListener('spinend', (e) => {
  console.log('Winner:', e.detail.result);
});

Click the pointer on the wheel to spin, or call wheel.spin() programmatically.

API

new WheelPicker(canvas, options)

OptionTypeDefaultDescription
choicesstring[]requiredList of items to display on the wheel
themestringrequiredColor theme name (see Themes)
interactivebooleantrueEnable click-to-spin on the pointer
showResultbooleantrueShow result label after spin
spinDurationnumber4000Spin animation duration in ms
spinJitternumber0.02Random angle variation added to each spin
minFontSizenumber10Minimum font size for segment labels
maxFontSizenumber100Maximum font size for segment labels
wheelColorstring'#f5f5f5'Center hub color
textColorstring'#000000'Segment label color
fontFamilystring'Arial Black, Arial, sans-serif'Font for segment labels

Methods

MethodDescription
spin(targetIndex?)Spin the wheel. Pass an index to land on a specific segment.
updateChoices(choices)Replace the current choices and redraw.
destroy()Remove event listeners and clean up.

Events

wheel.addEventListener('spinend', (e) => {
  const { result, index, angle } = e.detail;
  // result: winning label string
  // index: winning segment index
  // angle: final wheel rotation in radians
});

Themes

8 built-in color palettes:

NameDescription
Fresh AirSoft muted tones
PopcornWarm and vibrant
PlaygroundBold primary colors
SprinklesPastel variety
ChalkboardDeep saturated
Buddy SystemPaired complementary colors
Garden PartyLight and airy pastels
MarshmallowSoft pinks and blues

You can import the theme palette directly:

import { themes } from '@wheelfor/wheel-picker';

console.log(themes['Fresh Air']); // array of rgb() strings

TypeScript

Full TypeScript support is included. Import option types directly:

import { WheelPicker, WheelPickerOptions, SpinEndEvent } from '@wheelfor/wheel-picker';

const options: Partial<WheelPickerOptions> = {
  choices: ['Option A', 'Option B'],
  theme: 'Playground',
  spinDuration: 3000,
};

License

MIT

Keywords

wheel

FAQs

Package last updated on 03 May 2026

Related posts