# Seed dice

A seed you can roll: a 3D die tumbles while each digit spins like a slot drum.

Also called: dice roll, random seed.

Example: Roll the seed. Press the die: it tumbles in 3D while each digit of the seed spins like a slot drum and stops left to right. Lock keeps the seed. Preview: https://chatcn.dev/preview/seed-dice-demo

Press the die and it tumbles in three dimensions before landing on a face, while every digit of the seed spins like a slot drum and stops left to right on the new number. The lock keeps the seed: the die greys out and the digits stay put, so the next generation is reproducible.

## Installation

```bash
npx shadcn@latest add https://chatcn.dev/r/seed-dice.json
```

## Usage

```tsx
import { SeedDice } from "@/components/ui/chatcn/seed-dice"

<SeedDice seed={seed} onSeedChange={setSeed} locked={locked} onLockedChange={setLocked} />
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `seed` / `onSeedChange` | `number` |  |
| `locked` / `onLockedChange` | `boolean` | Shows the lock when set |
| `digits` | `number` | Default 6 |
| `label` | `string` | Default "Seed" |

## Accessibility

- The seed reads as one number; the roll and lock buttons are labelled.

## Motion

- The die is a CSS 3D cube, 760 ms to a random face after two or three tumbles. Each drum turns at least once, later digits longer.
- Reduced motion: the face and digits change in place.

Source: https://chatcn.dev/docs/components/seed-dice