Die

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/radio-die

About this component

Pick a number and a 3D die rolls to it: it hops up, tumbles a full extra turn on its way to the chosen face and lands with a squash while its shadow shrinks and grows underneath. Each roll adds another turn (a tiny script), so it never just rotates back.

Triggers

  • Click
  • State change
  • 3D

Techniques

  • preserve-3d
  • 3D transform
  • Keyframes
  • CSS variables

Difficulty

Advanced

Accessibility

Keyboard and screen readers

Real native radios (visually hidden: absolute, 1x1, opacity 0) inside <label>s in a role="radiogroup" with an aria-label, so arrow keys, focus and screen readers work.

Reduced motion

The changes are instant.

Use it in anything you build, commercial and client work included. Licence

More radios

See all
DrumGet code
FanGet code
Flip CardGet code
FoldersGet code