Copy button
Copies a value to the clipboard and shows the result.
Reference ID
REF-2026-0472copy-button-demo.tsx
Installation
The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.
npm
yarn
pnpm
bun
API reference
vip/ui adds or changes the props below. For all other props, see React Aria Button (opens in a new tab).
- value: stringRequired
- The exact text written to the clipboard.
- children: ReactNode | (status: CopyButtonStatus) => ReactNode
- The button content. Without it, the button shows an icon and status text. Pass a function to show content for each status. CopyButtonStatus is "idle", "copied", or "error".
- aria-label: string
- The accessible name. Without it, the name comes from text children in the idle status. Other children give the name "Copy". It does not change after a copy. A live region announces the result.
- variant: ButtonVariant = "outline"
- Uses the Button variants.
- size: "xs" | "sm" | "md" | "lg" | "xl" = "md"
- Uses the Button sizes.
- iconOnly: boolean = false
- Shows only the icon.