Get Started


  • NPM:

    npm install @dice-roller/rpg-dice-roller
  • Yarn:

    yarn add @dice-roller/rpg-dice-roller
  • CDN: JSDelivropen in new window

    <script src=""></script>

    Replace VERSION with the version you want to use.


ES modules

You can import the dice roller and use it in your application, using ES standard modules like so:

import * as rpgDiceRoller from '@dice-roller/rpg-dice-roller';

If you only want to import specific components, you can do so like:

import { DiceRoller } from '@dice-roller/rpg-dice-roller';



We only support Node.js 12+. Please check the browser support.


If you're using Node.js, with ES modulesopen in new window (import) instead of CommonJS (require) follow the ES modules examples above.

You can also load the library using CommonJS, AMD, etc. with the UMD build:

const rpgDiceRoller = require('@dice-roller/rpg-dice-roller');

If you only want to import specific components, you can do so like:

const { DiceRoller } = require('@dice-roller/rpg-dice-roller');


Browser support

We don't guarantee that the library works with all older browsers. We advise you to check the browser support.


First, you'll need to include some third party dependencies:

<script src=""></script>
<script src=""></script>

Dice Roller

You can either download the file locally, or use the CDN (Note umd in the path, instead of esm):

<!-- local file -->
<script src="./path/to/lib/umd/bundle.min.js"></script>

<!-- or CDN -->
<script src=""></script>

The UMD bundle provides the global variable, rpgDiceRoller, that is used to access the library.

  // create a new instance of the DiceRoller
  var diceRoller = new rpgDiceRoller.DiceRoller();