Share Button
betaA Share pill that springs open into a staggered row of share targets, with a built-in copy-link target and an optional hand-off to the native share sheet.
- Forms
- 1 file
- 2 npm packages
- Accessibility notes
- Animates with motion
pnpm dlx @dowel-ui/cli add share-buttonnpm packages installed: class-variance-authority, motion.
import { ShareButton } from "@/components/ui/share-button";Default
Variants
Click And Actions
Native
Sizes
<ShareButton>
| Prop | Type | Default |
|---|---|---|
copiedLabelAnnounced once the link is on the clipboard. | string | "Link copied" |
copyLabelName of the built-in copy target. | string | "Copy link" |
defaultOpenInitial open state when uncontrolled. | boolean | false |
groupLabelAccessible name for the group of targets. | string | "Share to" |
iconThe trigger's icon. Defaults to a share glyph. | ReactNode | — |
labelTrigger name and visible text. | string | "Share" |
nativeHand off to | boolean | false |
onCopyCalled with | (url: string) => void | — |
onOpenChange | (open: boolean) => void | — |
openControlled open state. | boolean | — |
openOn
| ShareButtonOpenOn | "hover" |
shareText
| string | — |
shareTitle
| string | — |
size | "sm" | "md" | "lg" | "md" |
targetsThe targets, in order from the trigger outward. | ShareTarget[] | [] |
urlThe link being shared. Adds a built-in "Copy link" target, last. | string | — |
variant | "solid" | "outline" | "soft" | "solid" |
Plus every attribute of <div> except onCopy, onDrag, onDragStart, onDragEnd, onAnimationStart.
8/8
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — does not apply
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes