Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Centered Light Confetti Unlock CTA Block for React

A centred card-in-card CTA that starts locked: one press throws confetti from the press point and the panel turns into its unlocked state, while three Pro features swap their locks for ticks.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Make the moment of saying yes feel like something, for React with Base UI. A muted shell with + marks on its corners wraps a raised panel that follows the theme. The panel starts locked: the heading "Unlock Pro", one line of copy, a button and, under it, three features (custom themes, shared workspaces, priority exports) each with a lock. Press the button and confetti flies from exactly where you pressed it while the panel cross-fades, in the same space, into "You unlocked Pro" with a Shine Button link to the Pro tools, a quiet way to lock it again and the same three features with ticks. The unlock button carries the Shine Button's light on a layer of its own, so the sweep never clips the burst. The confetti takes your theme's primary, foreground and destructive colours, so it matches every preset, and reduced motion skips the flight. It's built from Confetti Button, Shine Button, Button and Guides, with CSS transitions and Lucide icons. For upgrades, feature unlocks, completed onboarding and any call to action that deserves a small celebration.

FAQ

How do I make the button really unlock something?

unlock is the button's click handler: it sets unlocked and nothing else. Call your own code there, an upgrade request or a feature flag, and set unlocked when it succeeds; if it fails, leave the panel locked and show your error. Nothing here talks to a server, so the demo unlocks every time. The "Lock it again" button is only there to replay the demo, so remove it, and its handler lockAgain, in your version.

Where does the confetti come from and can I change it?

The button throws sixteen pieces from the point of the press, or from its centre when you press Enter or Space, in CSS: each piece's flight is set by its position in the burst and nothing re-renders. Pass colors, particleCount or duration to the button to change it. The default colours are shades of your theme's tokens, which is why the burst follows the preset.

Why is the Shine Button's light a separate layer here?

The Shine Button clips its light by hiding the button's overflow, and that would also cut off the confetti as it leaves the button. So the unlock button keeps its overflow visible and the light sweeps inside its own clipped, rounded layer under the label. It plays on hover, keyboard focus and press, and with reduced motion it fades in where it stands. The unlocked state's link is a plain Shine Button.

What happens with reduced motion?

The pieces don't fly: they fade in and out where they would land, and the cross-fade between the two states becomes an instant swap. The panel is the same height before and after, so nothing on the page moves.

What do keyboard and screen reader users get?

The locked and unlocked states sit in the same grid cell, and the one that isn't showing is hidden from view, from the keyboard and from screen readers, so only one heading is ever read. After the press, focus moves to the new heading, "You unlocked Pro", so it's read aloud; "Lock it again" returns focus to the unlock button. The confetti and the light are decoration and are hidden from assistive technology.

Why doesn't the panel change size when it unlocks?

Both states are always rendered in one grid cell, so the panel is as tall as the taller of the two. The locked state stays until the burst has played and then fades out while the unlocked one fades in. If you change the copy, keep the two states about the same length, or the shorter one will sit centred in the extra room.

How does it fit on a phone?

The panel's padding shrinks below the sm breakpoint, the heading steps down from text-4xl to text-3xl and balances over its lines, and the buttons and the three features wrap under each other when they don't fit. Nothing has a fixed width, so it reads at 320 pixels.

  • Pro

    Icon Medallion CTA

    Trust and security

    A split security prompt for a password vault: the headline and two actions at the start, and at the end a settings panel where a medallion swaps from an alert shield to a checked one when the two-factor switch turns on.

  • Pro

    A centred statement call to action for an accessibility scanner: a big headline, the Shine Button and an outline button, then a framed row of four trust cells on shared hairlines that each open a short note on what they cover.

  • Pro

    A centred statement for a notes app: a large headline, the Shine Button and a quiet changelog link beneath it whose underline grows from the middle, over a framed roadmap peek.

  • Pro

    A centred call to action drawn as a wide ticket with real notches and a perforated edge, framed by hairlines between the page rails: the Shine Button tears off the stub to reveal a copyable promo code.

  • Pro

    Icon Accent CTA

    With a closing band

    A band call to action with an accent icon in a hairline frame, a Shine Button and a docs link, and a closing band of three cells that fill in one by one when you press Deploy now.

  • Pro

    A centred statement CTA between solid rails: a one-line headline and a sentence, then the Shine Button and a ghost button in a hairline frame, with a hand-drawn arrow that draws itself toward the Shine Button from a handwritten note.