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 🙏

© 2024 – Pkg Stats / Ryan Hefner

generic-dice

v1.1.5

Published

A generic dice UI component rendered with React.js

Downloads

11

Readme

Generic-Dice wercker status generic-dice

Generic dice to add to any game using React.js

Note: this dice is purely a display component, it will not try to pick a random value. Instead, it needs to be set with a value and it will display it. The dice can also be animated to show that set value.

The main part component of this module is <GenericDice> but it's possible to use it as just <Dice> or any tag name that is suitable in your jsx.

Install

npm install generic-dice --save

Usage

Basic dice

Simplest dice without any value set (all defaults).

The code below display a single dice on its own. This same dice could also be mixed with other components, it doesn't have to be displayed by itself.

import React from 'react';
import { render } from 'react-dom';

import Dice from 'generic-dice';

render((
  <Dice />
), document.getElementById('game'));

Dice with a value set in face property

import React from 'react';
import { render } from 'react-dom';

import Dice from 'generic-dice';

render((
  <Dice face={6} />
), document.getElementById('game'));

Dice with a value, not rolling when first displayed and with a custom size of 10 pixels

import React from 'react';
import { render } from 'react-dom';

import Dice from 'generic-dice';

render((
  <Dice face={5} rolling={false} size={10} />
), document.getElementById('game'));

Mixing several dices

import React from 'react';
import { render } from 'react-dom';

import Dice from 'generic-dice';

render((
  <div>
    <Dice />
    <Dice face={6} />
    <Dice face={5} rolling={false} size={10} />
  </div>
), document.getElementById('game'));

Maintainers

  • Ernesto Paniagua: Developer and Designer
  • Nadjib Amar: Developer

Please fork this repository and improve our code; pull requests are welcome.

The main repository also has a list of issues, feel free to report new issues as you find them.

Documentation and unit testing are good starting points to contribute to this repository, but if you have some features you want to add to it, feel free to do so.

Further development

If you want to develop this component further, please see the Development help file.

Change log