Components
Five ways to open a card, and the pieces they are built from. All of it below is live, in whatever theme you pick: open the pack, spin the wheel.
Every one is the real component, not a recording.
Install
pnpm add @react-cards-opening/ui @react-cards-opening/core gsapimport "@react-cards-opening/ui/styles.css";How they fit
Every opener ends in the same reveal. CardHunt is ScanGrid and CardOpening wired to useCardOpening; CardSpin swaps the grid for a SpinReel, CardWheel for a PrizeWheel, and CardCase for a LootCase. CardPack runs on useCardPack and turns its cards where they lie. When the layout is yours (cards in a shop, a daily reward), use CardOpening on its own and tell it where a card leaves from and where it lands.
What they share
- `theme`: a CardTheme.
mossin the dark when left out. - `rarities`: your tiers. The six defaults when left out.
- Their own ground rules. Each resets only the elements it renders, at one class of specificity, so a page's
buttonorpstyles do not reach in and nothing leaks out. - Pixels, not rems. A page with a 10 pixel root font gets the same card as one with 16.
- `effects`: what each tier plays on top of its reveal. Six signature shows by default, from a library of dozens.
- `classNames`: a class of your own for any part, and a stylesheet where every rule weighs one class, so yours wins. Styling by hand has the Tailwind setup.