Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Copy Link Share CTA Block for React

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.

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 share call to action for referral and invite programs, for React with Base UI. Between the page's solid rails, a first band puts the pitch on the start side (a headline and a line that leads with the deal) and the visitor's invite link on the end side, in a read-only field with a Copy link Shine Button beside it. Under the field are two ways to send the link as plain text links: an email that opens in the visitor's mail app with the message already written, and a Share link that opens the system share sheet, shown only in browsers that have one. A second band closes the section under a rule with + marks: three cells on shared hairlines count the invites sent, the invites accepted and the months earned. On a phone the field and the button stack, each at full width. It's built from Guides, Clipboard and Shine Button, with CSS transitions for the entrance and your theme's tokens for every colour, so the block is light in a light theme and dark in a dark one. For viral growth loops, ambassador pages, product announcements and any section where sharing is the action.

FAQ

What happens when someone copies the link?

The Copy link button writes the link to the clipboard, swaps its copy icon for a check and its label for "Copied" for three seconds, and a polite status tells screen readers "Copied". If the clipboard refuses (a page not served over HTTPS, or permission denied), the icon turns into a cross, the label reads "Copy failed" and the status says "Couldn't copy". The three labels share one cell, so the button never changes width and nothing around it moves.

Why is there no Share link on some browsers?

The Share link calls the browser's own share sheet, which not every browser has. After the page loads, the block checks for it and shows the link only when it exists, so no one is offered a control that does nothing. The email link works everywhere: it is a plain mailto: link with the subject and the message written, so it opens whichever mail app the visitor uses.

How does a screen reader meet the link field?

The field is a real read-only input named "Your invite link", so the address is read out and can be selected by keyboard or touch, but not changed. It's always laid out left to right, even on a right-to-left page, so the address never reorders. The counts below are a description list: each figure is read with its label.

Where do the invite counts come from?

They are typed data at the top of the file: INVITES holds the sent and accepted numbers and the months earned are worked out from the accepted ones, one month each, so the three figures can't disagree. Replace them with your referral numbers, or remove the closing band if you'd rather show just the link; the section then ends on the first band, so restore the column's bottom padding.

How does it look on a phone?

The pitch comes first, then the field and the button stacked at full width, then the share links, which wrap onto a second line if they don't fit. The three counts stay in one row of cells.

  • Pro

    Dual Action CTA

    Slim bands

    A band call to action between solid rails with one split button: a Shine Button Get started link joined to a chevron that opens a menu of other routes, beside a headline and a sentence, in your theme.

  • Pro

    A call to action between solid rails that follows the page theme, in a card in card with a two-step email capture: an email field and a Shine Button, then a six-digit code that verifies on the sixth digit and turns into a confirmation in the same space.

  • Pro

    A centered card-in-card CTA for a mobile app with iOS and Android download links, and a text-me-the-app form in a ruled band that has a country-code select and turns into a confirmation.

  • Pro

    Language Chips CTA

    Pickers and toggles

    A split call to action for a product that speaks your users' language: the pitch and a Shine Button beside a framed greeting over a cloud of language chips that switch the greeting and the button's label, each in its own language and direction.

  • Pro

    Install Command Hero

    Code and terminal

    A compact centred hero for an open-source library with a star count pill, an install command to copy, a Shine Button, a GitHub star button and a ruled band of the repository's stats at the foot.

  • Pro

    Referral Rewards Pricing

    Discounts and offers

    Referral pricing as a copyable invite link over a three-step reward track: friends invited and joined (2 of 3), the free months each step pays (1 month, 3 months, a year) and what's already earned.