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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-fortune-roulette

v1.0.5

Published

A fork of react-roulette-game adapted for modern React versions and extended functionality

Downloads

18

Readme

React Fortune Roulette

A customizable fortune wheel (roulette) React component built with framer-motion. Perfect for gamification, reward systems, promotions, and mini-games.

🎯 This is a fork of react-roulette-game, modernized for:

  • React 18+
  • TypeScript support
  • framer-motion v11+
  • Better UX & structure

🚀 Demo

Try it live:
👉 https://dmitriy-morozov.github.io/react-fortune-roulette-demo/

✨ Features

  • Fully animated with framer-motion
  • Customizable wheel, pointer, and highlight images
  • "Try Again" mode
  • Configurable spin duration and spin limit
  • Callbacks for spin start, completion, and gift receiving

📦 Installation

npm install react-fortune-roulette

🚀 Usage

import { Roulette, RouletteProps } from "react-fortune-roulette";

const App = () => {
  return (
    <Roulette
      wheelImageBase="/images/wheel-base.png"
      wheelImageOverlay="/images/wheel-overlay.png"
      pointerImage="/images/pointer.png"
      highlightImage="/images/highlight.png"
      prizeList={['Baseball', 'Rugby', 'Tennis', 'Soccer', 'Badminton', 'Basketball']}
      spinsLimit={3}
      duration={5}
      onStart={() => console.log("Spin started")}
      onComplete={(prize) => console.log("Spin complete:", prize)}
      onReceiveGift={(prize) => console.log("Gift received:", prize)}
      startText="Spin the Wheel!"
      tryAgainText="Try Again!"
      receiveGiftText="Claim your Prize!"
    />
  );
};

📌 Props

| Prop | Type | Default | Description | |---------------------------|---------------------------|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------| | wheelImageBase | string | required | Background image of the base wheel. | | wheelImageOverlay | string | required | Foreground overlay image of the wheel. | | highlightImage | string | required | Image shown as blinking highlight effect after spinning. | | pointerImage | string | required | Static pointer image placed on top of the wheel. | | prizeList | string[] | required | Array of prize values, the order is counter-clockwise to your roulette. Include "try_again" to enable "Try Again" logic. | | spinsLimit | number | 1 | Number of spins allowed. | | duration | number | 6 | Duration of the total spin animation (in seconds). | | isShowReceiveGiftButton | boolean | true | Whether to show the "Receive Gift" button after spinning. If false, the gift should be handled directly inside the onComplete callback. | | startText | string | "Start!" | Label text for the Start button. | | tryAgainText | string | "Try Again" | Label text for the Try Again button. | | receiveGiftText | string | "Receive a gift" | Label text for the Receive Gift button. | | onStart | () => void | () => {} | Callback triggered when the spin begins. | | onTryAgain | () => void | () => {} | Callback triggered when the Try Again spin begins. | | onComplete | (prize: string) => void | () => {} | Callback triggered when the spin ends and a prize is selected. | | onReceiveGift | (prize: string) => void | () => {} | Callback triggered when the user receives a gift (if not "try_again"). |

wheelImageBase

usage: roulette's body image, its zIndex is smaller than highlight; HIGHLY RECOMMENDED: the ratio of this image should be square

wheelImageOverlay

usage: roulette's body image, its zIndex is bigger than highlight; HIGHLY RECOMMENDED: the ratio of this image should be square

highlightImage

usage: when roulette rotate over, hightlight will bling bling, its purpose is to highlight the winning-prize;
HIGHLY RECOMMENDED: the ratio of this image should be square

pointerImage

usage: roulette's pointer, to point the winning-prize;
HIGHLY RECOMMENDED: the ratio of this image should be square

PS1: you can put your roulette's body image on one of them or both; just due to different design, something will be under the highlight and something will be on the highlight, so let you have more option to combine your roulette

PS2: your roulette should put like this:

not like this:

PS: the prize you win always on top, so your pointer should always point toward that one, like this:

🎨 Styling

This component includes default SCSS styles that are automatically imported when you use the package — no need for manual imports.

If you want to customize the appearance, you can override the following class names in your project's CSS or SCSS:

.roulette-container
.roulette-box
.roulette-board
.roulette-highlight-area
.roulette-pointer
.roulette-btn
.start-btn
.try-again-btn
.gift-btn