Back to components
ComponentAlertFree

Dice Discount Popup React component

A gamified discount popup, roll two animated 3D dice for a reward tier (with a doubles bonus), copy the code, and track rolls left across a session. Inline or corner-widget popup with manual, delay or scroll triggers.

About the Dice Discount Popup component

Dice Discount Popup is a free gamified offer. Visitors roll two 3D dice, the total maps to a reward tier and doubles win a bonus prize, and each win opens a 'You won' dialog with a code to copy. Each visitor gets three rolls, and the rolls left and rewards won are saved in localStorage so a reload doesn't reset them.

theme picks ecommerce, campaign or saas. Each theme's title, reward tiers, codes and doubles bonus are defined in the THEMES object in the source, not in props. accentColor colors the buttons. asPopup turns it into a floating corner widget that opens a modal, trigger (manual, delay or scroll) with delaySeconds decides when it opens, widgetPosition picks the corner and storageKey namespaces the saved state. The result and status lines are aria-live regions, the dialogs are labeled and close with Escape, and focus returns to the widget button when the popup closes.

When to use it

Use it for e-commerce welcome offers, sale campaigns and SaaS trial nudges, where an element of play can raise engagement.

For a scratch-off mechanic, use Scratch Card Popup. For a plain offer card, use Sales Ticket Popup.

Installation

Add the Dice Discount Popup component to your project with the shadcn CLI. It lands in components/dice-discount-popup.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/dice-discount-popup

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

Related components

Scratch Card Popup
Free
Sales Ticket Popup
Free
Exit-intent Popup
Free
Newsletter Popup
Free
SEO-ready
Blog Article Cards
SEO-ready
Related Posts