Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Stacked Referral Invite Banner Block for React

A referral card for a savings app: a heading, two reward cells (You get, A friend gets) joined by an arrow, and the invite link in a field with a Copy link button.

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

A referral card for React with Base UI, for a programme where both sides win. A framed card with + marks on its corners opens with a heading and one sentence. Under them, two reward cells on a shared hairline read "You get" and "A friend gets", ten dollars each, with an arrow in a circle between them that turns around in right-to-left layouts. At the foot, the visitor's invite link sits in a field with the catalog's Copy Button: pressing it copies the link, swaps the copy icon for a check, and tells screen readers "Invite link copied". There's no primary colour: the link and its button are the action. It's built from Guides and Copy Button with a Lucide icon and your theme's tokens for every colour. For savings, banking and subscription apps, and any growth surface where the offer is symmetrical.

FAQ

How do I change the reward?

Edit REWARD at the top of the file: both cells and the heading read it, so they can never disagree. For different amounts on the two sides, give each entry of SIDES its own amount and show it in RewardCell; keep the price in a dir="ltr" span so the currency sign stays beside its digits in right-to-left layouts.

What happens when the clipboard is blocked?

The Copy Button catches the refusal (a page not served over HTTPS has no clipboard, and a browser may deny permission), shows a cross for three seconds and tells screen readers "Couldn't copy". The link stays selectable in the field, so the visitor can copy it by hand. Pass onCopyError to the button to offer another way, such as the system share sheet.

Can it open the share sheet instead?

Yes: call navigator.share({ url: INVITE_URL }) where the browser has it (check typeof navigator.share === "function" after the first render, so the server and the browser agree) and keep the copy button as the fallback. The block keeps to one button so the choice is clear.

How does it fit on a phone?

The heading wraps to two lines, the two cells stay side by side with the arrow between them, and the field spans the card with the button at its end. Nothing scrolls sideways at 320 pixels.

  • Pro

    Copy Link Share CTA

    Forms and capture

    A band call to action for a referral programme that follows your theme: the pitch beside a read-only invite field with a Shine Button that copies it, real email and system share links, and a closing band counting invites.

  • Pro

    A centred bonus offer for a music-learning app: a gift tile, a Limited time badge, a heading, a strip of fifteen month cells with the last three outlined as free, and a Shine Button.

  • Pro

    A centred download card for a desktop sketching app: a version badge, a heading and a sentence over a tinted band with a three-platform segment control and a download button that runs idle, downloading and done.

  • Pro

    A staging pill for a deploy platform: a status dot and the environment's name, the branch and the commit hash in mono, and a copy button for the hash.

  • Pro

    A centred social-proof card for a team workspace: a line saying who and how many teams upgraded this week, with the count rolling up, a sentence, a ringed avatar stack and a Shine Button.

  • Pro

    A centred milestone card for a running app: a corner ribbon reading Unlocked, a trophy, a heading, one sentence, a track of five pips with three earned, the next milestone named, and a Shine Button.