Back to elements
ElementMiscFree

Share Buttons React component

Share buttons for X, LinkedIn, Facebook, Reddit, WhatsApp and email with a copy-link button that turns into a tick: round icons with hover labels, labelled pills, or a single Share button that fans out into the row, plus the device's own share sheet where it exists.

When to use the Share Buttons component

Use Share Buttons at the end of articles, on product pages and after sign-up or purchase moments, where people are most likely to pass a page on.

Keep the list short (three or four networks your audience actually uses) and include copy link; on phones add native to open the system share sheet.

Installation

Add the Share Buttons component to your project with the shadcn CLI. It lands in components/share-buttons.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add https://reactframe.com/r/share-buttons.json

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

Props

<ShareButtons /> accepts 8 props, all optional.

  • url
    string
    Default: "https://reactframe.com/elements"
  • title
    string
    Default: "React Frame · Elements"
  • text

    Extra text for networks that take it (X, WhatsApp, email body).

    string
    Default: "Animated React elements you can copy in seconds."
  • networks
    ("x" | "linkedin" | "facebook" | "reddit" | "whatsapp" | "email" | "copy" | "native")[]
    Default: ["x", "linkedin", "facebook", "reddit", "whatsapp", "email", "copy"]
  • variant

    icons: round buttons with a hover label. pills: icon and label. expand: one Share button that opens into the row.

    "icons" | "pills" | "expand"
    Default: "icons"
  • onShare
    (network: ShareNetwork) => void
  • theme
    "dark" | "light"
    Default: "dark"
  • className
    string

FAQ

Do these load third-party scripts?
No. Each button is a plain link to the network's share page with your URL and text filled in, so nothing tracks visitors until they click.
What does 'native' do?
It opens the device's own share sheet (messages, notes, AirDrop and so on). It only appears in browsers that support it.
Can I record shares?
Pass onShare; it's called with the network name for every click, before the share page opens.

More Misc components

Social Links
Free
Theme Toggle
Free
Scroll Progress Bar
Free
Inline Edit
Free
Payment Button
Free
Terminal
Free