StealThis .dev

Upsell — Win-back / discount offer modal

A self-contained exit-intent win-back modal for the fictional Northwind Cloud. As a user abandons checkout, a celebratory dialog offers 30 percent off their first three months — a spinning starburst discount badge, a strikethrough comparison of the standard versus discounted monthly price, and a copyable promo code field with a copied toast. A live urgency countdown ticks toward expiry, while Claim offer and No thanks actions, a focus trap, and Escape-to-close keep it fully keyboard accessible.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Win-back / discount offer modal

A complete exit-intent retention pattern for the fictional Northwind Cloud, art-directed in the neutral product palette with an indigo brand and a celebratory teal accent. Behind the offer sits a believable checkout shell — an order summary for Northwind Pro at $24/mo with a 14-day trial — so the interruption reads like a real abandonment moment. When the cursor leaves through the top of the viewport (or you tap any trigger), a centered role="dialog" modal pops in with a spinning SVG starburst around a circular 30% OFF badge. No confetti, just a confident accent.

The body pairs the old and new prices side by side: a struck-through $24/mo standard rate next to the discounted $16.80/mo with a “Save $7.20/mo” pill. A dashed promo-code field holds STAYWITHUS30 with a one-tap copy button that swaps its icon to a checkmark, flips to “Copied”, glows the field, and fires a toast — backed by a document.execCommand fallback for older or sandboxed environments. An amber urgency chip counts down from 10:00 in tabular numerals via an aria-live region, then flips to an expired state when it hits zero. “Claim 30% off now” and a quieter “No thanks, maybe later” close the dialog with contextual toasts.

Everything is vanilla HTML, CSS, and JS with inline SVG icons — no frameworks, no build step, and no network requests beyond the Inter web font. The dialog uses aria-modal, a Tab focus trap, Esc and overlay-click to dismiss, and focuses the least-destructive action on open. A prefers-reduced-motion block neutralizes the pop, spin, and pulse animations, and below 520px the price comparison stacks vertically and the copy button collapses to its icon.

Illustrative UI only — the brand, prices, and promo code are fictional; not a real offer.