trocar-react-dice
v0.0.2
Published
react component for dice rolling such as d6, d8, d10, d12, d20, d100.
Downloads
2
Readme
Trocar React Dice
Install
npm install trocar-react-dice
Use
import React from 'react';
import Dice from 'trocar-react-dice/dice';
export default ()=><>
Dice Roller:
<Dice>
</>
Options
<Dice theme="default"/>
<Dice theme="dark"/>
<Dice collapsed={true}/>
<Dice collapsed={false}/>
Advanced use
import React,{useState} from 'react';
import DiceRoller from 'trocar-react-dice/dice-roller';
export default ()=>{
const [result,setResult] = useState(-1);
return <>
<DiceRoller theme={theme} onResult={(dieCount, dieSides, result)=>{
setResults([...results,{
results: result,
sides: dieSides,
count: dieCount,
time: new Date()
}])
<h1>You got a {result}</h1>
}}/></>
}