npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@firstform/spinnerwheel

v1.1.0

Published

React spinner wheel component for random selection with animations

Downloads

40

Readme

@firstform/spinnerwheel

A customizable React spinner wheel component for random selection with smooth animations, sound effects, and confetti celebrations.

Installation

npm install @firstform/spinnerwheel

Quick Start

import { SpinnerWheel, useSpinnerWheelState } from '@firstform/spinnerwheel';
import '@firstform/spinnerwheel/styles';

function App() {
  const wheel = useSpinnerWheelState({
    initialEntries: [
      { id: '1', name: 'Pizza' },
      { id: '2', name: 'Burger' },
      { id: '3', name: 'Sushi' },
    ],
  });

  return (
    <SpinnerWheel
      entries={wheel.entries}
      isSpinning={wheel.isSpinning}
      winner={wheel.winner}
      currentSegment={wheel.currentSegment}
      showWinnerPopup={wheel.showWinnerPopup}
      onEntriesChange={wheel.setEntries}
      onSpin={wheel.spin}
      onSpinComplete={wheel.handleSpinComplete}
      onSegmentChange={wheel.handleSegmentChange}
      onWinnerPopupClose={wheel.closeWinnerPopup}
    />
  );
}

Features

  • Smooth spinning animations powered by GSAP
  • Confetti celebration on winner selection
  • Audio feedback (tick sounds and celebration)
  • URL sync for shareable wheels
  • Multiple color themes
  • Dark and light theme variants
  • Table and default layout options
  • Fully typed with TypeScript

Components

SpinnerWheel

The main component that includes the wheel, entry management, and winner popup.

<SpinnerWheel
  // Required props
  entries={entries}
  isSpinning={isSpinning}
  winner={winner}
  currentSegment={currentSegment}
  showWinnerPopup={showWinnerPopup}
  onEntriesChange={setEntries}
  onSpin={spin}
  onSpinComplete={handleSpinComplete}
  onWinnerPopupClose={closeWinnerPopup}

  // Optional props
  canvasSize={465}
  variant="white" // 'white' | 'dark'
  layout="default" // 'default' | 'table'
  showEntryInput={true}
  audioEnabled={true}
  confettiEnabled={true}
  colorTheme="default" // 'rainbow' | 'sunset' | 'ocean' | 'forest' | etc.
  spinDuration={10}
  spinRevolutions={7}
/>

SpinnerWheelCanvas

Just the wheel canvas without entry management UI.

import { SpinnerWheelCanvas } from '@firstform/spinnerwheel';

<SpinnerWheelCanvas
  entries={entries}
  isSpinning={isSpinning}
  onSpinComplete={handleComplete}
  onSegmentChange={handleSegmentChange}
  onSpin={handleSpin}
/>

Hooks

useSpinnerWheelState

Manages all wheel state with optional URL synchronization.

const wheel = useSpinnerWheelState({
  initialEntries: [],
  syncToUrl: true, // Sync entries to URL for sharing
  onWinnerSelected: (winner) => console.log('Winner:', winner),
});

// Returns:
// - entries, isSpinning, winner, currentSegment, showWinnerPopup
// - setEntries, addEntries, removeEntry, clearEntries
// - spin, handleSpinComplete, handleSegmentChange, closeWinnerPopup, reset

useAudio

Control audio playback.

const audio = useAudio({ enabled: true });
audio.playTick();
audio.playCelebration();

useConfetti

Trigger confetti effects.

const confetti = useConfetti({ enabled: true });
confetti.fire();

Types

interface WheelEntry {
  id: string;
  name: string;
}

type ThemeVariant = 'white' | 'dark';
type LayoutVariant = 'default' | 'table';
type ColorTheme =
  | 'default' | 'rainbow' | 'sunset' | 'ocean'
  | 'forest' | 'candy' | 'neon' | 'pastel'
  | 'blues' | 'reds' | 'greens' | 'earth' | 'retro';

Color Themes

Choose from 13 built-in color themes:

  • default - Balanced mix of colors
  • rainbow - Full spectrum
  • sunset - Warm oranges and reds
  • ocean - Blues and teals
  • forest - Greens and earth tones
  • candy - Bright pinks and purples
  • neon - Vibrant glowing colors
  • pastel - Soft muted tones
  • blues / reds / greens - Monochromatic
  • earth - Natural brown tones
  • retro - Vintage color palette

URL Sharing

Enable syncToUrl to automatically encode entries in the URL:

const wheel = useSpinnerWheelState({
  syncToUrl: true,
});

// Get shareable URL
import { getShareableUrl } from '@firstform/spinnerwheel';
const url = getShareableUrl(entries);

License

MIT