Mines

Preview

Best cash out 0.00×

Mine count. Current value: 3 mines
3 mines
1.00×

First pick 88% safe

Tiles

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/mines

API Reference

size?
number

Tiles per side, rounded, at least 2. Default 5 (a 5 × 5 board). Changing it ends the round.

Default5
mines?
number

Mines on the board (controlled), rounded and kept between 1 and tiles − 1. Takes effect from the next round.

Default—
defaultMines?
number

Initial mine count when uncontrolled. Default 3.

Default3
onMinesChange?
((mines: number) => void)

Called when the mine count changes between rounds.

Default—
onReveal?
((tile: number, result: MinesTile, multiplier: number) => void)

Called for every tile picked during a round; a mine reports multiplier 0 and ends it.

Default—
onCashOut?
((multiplier: number, gems: number) => void)

Called when the player cashes out, or clears every gem.

Default—
sound?
boolean

Play synthesized sounds (controlled): gem chimes, a mine blast and a cash-out arpeggio.

Default—
defaultSound?
boolean

Initial sound state when uncontrolled. Default false.

Defaultfalse
onSoundChange?
((sound: boolean) => void)

Called when the sound button is toggled.

Default—
showResult?
boolean

Show the result card when a round ends. Default true.

Defaulttrue
aria-label?
string

Accessible name for the game. Default "Mines".

DefaultMines
className?
string
Default—

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.

Updated