Copy Button
An icon button that copies text to the clipboard, morphs its icon from a copy glyph to a checkmark, and anchors a confirmation toast to itself — built on Tooltip and the anchored Toast. It brings its own toast manager and provider internally, so it drops in anywhere with zero setup.
Last updated January 1, 1980
Overview
Installation
Usage
No provider to wrap — the copy confirmation is a toast anchored to the button itself (not a corner-stacked one), and CopyButton manages that internally by default.
import { CopyButton } from "@/components/ui/copy-button"
export function Example() {
return <CopyButton text="https://persian-labs.ir" label="Copy link" />
}Examples
With Text
It's a regular Button under the hood, so any variant, size, or children work — pass a label as children alongside the icon.
RTL
The default label is already Persian ("کپی"), and the anchored confirmation toast mirrors correctly since it goes through the same direction-aware AnchoredToastProvider as Toast.