Skip to main content

ScratchTicket

ScratchTicket is the high-level ticket/gameplay component from @luxy-creative/scratch-card. Use it when you want built-in ticket layouts, scratch zones, gameplay presets, cover materials, and optional scratcher-tool visuals.

Basic ticket

import { ScratchTicket } from "@luxy-creative/scratch-card";

<ScratchTicket
outcome={outcome}
game={{ type: "number-match", winningNumbers, yourNumbers }}
layout={{ title: "luxy cash", topPrizeLabel: "WIN $20 OFF" }}
scratcher
/>;

Gameplay presets

GamePurpose
number-matchWinning numbers, your numbers, prize per play, and optional bonus entries.
symbol-gridGrid cells with row, column, diagonal, or custom pattern helpers.
bonus-revealInstant-win, multiplier, or mystery bonus spots.
customCaller-supplied zones, metadata, renderers, and optional preview evaluator.

Layout presets

  • classic-number-match
  • compact-ticket
  • grid-game
  • custom

Backend-resolved ticket

<ScratchTicket
resolveOutcome={(context) => api.reserveReward(context.interactionId)}
game={{
type: "number-match",
winningNumbers: [7, 12, 21, 34],
bonusEntries: [{ id: "bonus-1", value: "BONUS", bonusSymbol: "BONUS", prize: { label: "Free shipping" } }],
yourNumbers: [
{ id: "your-1", value: 7, prize: { label: "$20 off" } },
{ id: "your-2", value: 18, prize: { label: "Try again" } },
],
}}
layout={{ preset: "classic-number-match", title: "luxy cash" }}
cover="premium"
scratcher
/>;

Assets

Asset slots use expo-image source values.

SlotPurpose
backgroundFull ticket background image.
logoBrand mark or merchant logo.
revealedZoneOptional revealed zone art.
unrevealedZoneOptional covered zone art.
coverPatternDecorative play-surface pattern.
footerFooter art.
serialSerial/validation art.
symbolAssetsSymbol id to image-source map.

Effects

<ScratchTicket
outcome={outcome}
cover="premium"
effects={{
particles: { maxParticles: 72 },
shader: "auto",
sparkle: { maxSparkles: 18, opacity: 0.9 },
}}
layout={{ title: "luxy cash", topPrizeLabel: "Foil coupon reveal" }}
scratcher
/>;

Reduced motion disables shimmer, dust particles, sparkle glints, and animated flourish, but it does not disable revealing or callbacks.

Core props

PropPurpose
gameSelects typed gameplay and zone generation.
layoutSelects or configures the ticket frame.
assetsSupplies ticket images and symbol art.
themeOverrides ticket colors.
coverSelects matte, foil, premium, a React node, or a render callback.
scratcherEnables and configures the bundled scratcher-tool visual.
effectsControls particles, sparkle, shader fallback, foil, and quality.
renderZoneCustomizes zone content.
renderFrameCustomizes the whole ticket frame.
onZoneProgressReceives per-zone progress.
onZoneRevealReceives per-zone reveal completion.