Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-roulette

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

react-roulette

A very simple (and buggy) React Roulette you can roll that I made in a couple of hours.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

React Roulette

This is a very simple React component wich allows you to display an interactive roulette that can be thrown and it returns the selected value to be used.

Demo

Installation and usage

You can use this component by installing with npm:

npm i react-roulette

Then import it in your app:

import React from 'react';
import Roulette from 'react-roulette';

const App = () => {
	const items = ['Apple', 'Banana', 'Cherry'];
	const colors = ['#F76156', '#FBD1A2', '#BED558'];

	return (
		<div className="App">
			<h1>React Roulette</h1>
			<Roulette items={items} colors={colors} />
		</div>
	);
}

export default App;

Props

Required props:

  • items - Array of items to display.
  • colors - Array of colors to use. If it's smaller tha than the items it's used in loop.

Optional props:

  • frameColor - Color for the frame and the arrow. Default: white.
  • centerColor - Color for the center button. Default: #333.
  • image - Url of an image to use inside the center button.
  • clickSpeed - Speed to rotate the roulette when the center button is clicked. Default: 50.
  • friction - Friction applied to the rotation. Default: 0.005.
  • onChange - Function triggered when the roulette stops. Returns the element where it landed as an argument.

Keywords

FAQs

Package last updated on 28 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc