Skip to content
VenusUI
Get started

Dice Roller

3D dice that tumble and land on a fair, random face, with the total announced.

Preview

Installation

npx shadcn@latest add @venusui/dice-roller

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/dice-roller.tsx

Usage

The code behind the preview above.

dice-roller-demo.tsx

import { DiceRoller } from "@/components/ui/dice-roller"

export default function DiceRollerDemo() {
  return <DiceRoller />
}

API reference

PropTypeDefaultDescription
countnumber2How many dice.
onRoll(values: number[]) => void—Called with each roll.

All <div> props.

Requirements

  • React 19 and Tailwind CSS v4.

Customization

  • Use any count; the dice wrap onto more rows on small screens.

Accessibility

  • Each die and Roll are buttons; the result is announced.

Troubleshooting

Something looks different from the preview.
Components use your project’s theme tokens, so surrounding colours and radius follow your styles.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A card that tilts in 3D toward the pointer with spring physics.

Loading preview

Bubble Wrap

Interactive

A sheet of bubble wrap to pop one by one, or a whole row with a drag.

Loading preview

Camera Shutter

Interactive

A lens with a working iris: blades close to the chosen aperture and snap shut when you release the shutter.