Share Button

A round button that fans share actions out on an arc.

Preview

"use client";

import { ShareButton } from "@/components/motion/share-button";

// The button shares nothing itself; each action calls this with its id
// ("copy", "email" or "message"). Return a promise to show the check once
// your share settles.
async function share(_id: string) {
  // Copy a link, open a composer or call your API here.
}

export function ShareButtonUsage() {
  return (
    // The actions fan out above the button; leave room for them.
    <div className="pt-20">
      <ShareButton onAction={share} />
    </div>
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/share-button

API Reference

actions?
ShareAction[]

Replace the default copy link, email and message actions.

Default—
onAction?
((id: string) => unknown)

Called with the action's id. The button does no sharing of its own: copy the link, open a composer or call your API here. Return a promise to show the check once it settles; if it rejects, the fan stays open.

Default—
labels?
Partial<{ share: string; close: string; copy: string; copied: string; email: string; message: string; }>

Override any built-in string, e.g. for translation.

Default—
sound?
boolean

Play open and close swishes for the fan and a success chime when an action is done. Off by default; a `SoundProvider` can mute it app-wide.

Defaultfalse
className?
string

Classes merged onto the root element.

Default—

Updated