Skip to content
↑↓ to navigate↵ to openesc to close

Menu

Preview

Score 0 · 0 balls

Install

Add it with your package manager, or copy the source manually.

Run it in a project set up with shadcn-vue. The source is copied to components/beui and its dependencies are added to your package.json. Read the shadcn-vue guide

bunx --bun shadcn-vue@latest add @beui-vue/plinko

Import the shared styles once in your application.

TSUsage
import Plinko from '@/components/beui/games/Plinko.vue'
import '@/components/beui/styles.css'

API Reference

rows?
number

Rows of pegs when `slots` isn't passed. Default 12.

Default12
slots?
readonly PlinkoValue[]

Slot values, left to right. Their count sets the board: n slots get n - 1 rows of pegs, so `rows` is ignored when this is passed.

Default—
@land?
(slot: number, value: PlinkoValue) => void

Called with the slot index and its value when a ball lands.

Default—
maxBalls?
number

Balls allowed in flight at once. Default 12.

Default12
dropLabel?
string

Label of the drop button. Default "Drop ball".

Default—
v-model:pegFlash?
boolean

Flash each peg as the ball hits it (controlled). Hidden with reduced motion, where no pegs are hit.

Defaultundefined
defaultPegFlash?
boolean

Initial peg flash state when uncontrolled. Default true.

Defaulttrue
pegFlashLabel?
string

Tooltip and accessible name of the peg flash button. Default "Peg flash".

Default—
v-model:sound?
boolean

Click on every peg hit and landing (controlled).

Defaultundefined
defaultSound?
boolean

Initial sound state when uncontrolled. Default false.

Defaultfalse
soundLabel?
string

Tooltip and accessible name of the sound button. Default "Sound".

Default—
aria-label?
string

Accessible name for the board. Default "Plinko board".

Default—
labels?
Partial<PlinkoMessages>

Override built-in text for this instance.

Default—
class?
string
Default—
random?
() => number

Injectable random source, for reproducible drops.

DefaultMath.random()
@peg-flash-change?
(value: boolean) => void
Default—
@sound-change?
(value: boolean) => void
Default—

Updated