Toss Deck

Toss Deck

A card deck with weight — drag the top card past the threshold and it flies off with a spin, then slips back under the pile.

Installation

▸ Run the following command

npx shadcn@latest add https://www.mellowui.com/r/toss-deck.json

▸ Or install manually

  1. Install dependencies: pnpm add motion
  2. Copy the source from the Code tab above.
  3. Place it at components/mellow/toss-deck.tsx
  4. Import and use.

API Reference

PropTypeDefaultDescription
itemsReactNode[]Card faces, front of deck first.
widthnumber320Card width in px.
heightnumber420Card height in px.
peeknumber2Cards visible behind the top card.
counterbooleantrueShow the 01 / 05 counter under the deck.
onChange(index: number) => voidCalled with the item index that lands on top after a toss.
classNamestringAdditional CSS classes.