npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-copy-button.json --yesCopy button
ProA button that copies a value such as a link, a key or a command to the clipboard and says it was copied in place, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
import { CopyButton } from '@/components/ui/goop/copy-button';
import { TextInput } from '@/components/ui/goop/text-input';
<>
<div className="flex w-full items-center gap-2">
<TextInput
aria-label="API key"
readOnly
value="key_live_7Hq2xV9mK4tR8wN3cL6p"
className="min-w-0 flex-1 text-ellipsis"
/>
<CopyButton value="key_live_7Hq2xV9mK4tR8wN3cL6p" label="Copy key" variant="outline" size="lg" />
</div>
<CopyButton value="https://example.com/invite/7f3a9c" label="Copy invite link" iconOnly variant="outline" size="md" />
</>When to use
- A button that copies a value such as a link, a key or a command to the clipboard and says it was copied in place.
- Also called: copy to clipboard.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Copy button on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-copy-button.json --yesAdd the Goop Copy button to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { CopyButton } from '@/components/ui/goop/copy-button';
import { TextInput } from '@/components/ui/goop/text-input';
<>
<div className="flex w-full items-center gap-2">
<TextInput
aria-label="API key"
readOnly
value="key_live_7Hq2xV9mK4tR8wN3cL6p"
className="min-w-0 flex-1 text-ellipsis"
/>
<CopyButton value="key_live_7Hq2xV9mK4tR8wN3cL6p" label="Copy key" variant="outline" size="lg" />
</div>
<CopyButton value="https://example.com/invite/7f3a9c" label="Copy invite link" iconOnly variant="outline" size="md" />
</>- Fits: settings (its recipe).
- Also known as: CopyToClipboard, ClipboardButton, Clipboard.
- Put a CopyButton at the end of any value a person will paste elsewhere — a key, a link, an id — and let it confirm in place; use
ChatMessageCopyin a chat message, and never a Toast for the confirmation. - width, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| value | string | What is copied: the exact text put on the clipboard. |
| label? | string = 'Copy' | The words at rest; with iconOnly, the button's name — say what is copied ("Copy API key"). |
| copiedLabel? | string = 'Copied' | The words once the value is on the clipboard. |
| failedLabel? | string = 'Couldn’t copy' | The words when the copy failed. |
| iconOnly? | boolean = false | The glyph alone, on the theme's IconButton; label names it. |
| variant? | 'ghost' | 'outline' = 'ghost' | ghost (no fill at rest) or outline (the surface fill on its ring). |
| size? | 'sm' | 'md' | 'lg' = 'sm' | sm 24 px, md 28 px, lg 32 px (beside a TextInput). |
| onCopy? | (value: string) => void | Called with value once it is on the clipboard. |
| onClick? | (event: MouseEvent) => void | |
| disabled? | boolean |
- data-slot values (to select a part by): copy-button, copy-button-status, copy-button-text
Keyboard
| Key | What it does |
|---|---|
| Enter | Copy the value; the focus stays on the button |
| Space | Copy the value; the focus stays on the button |
Accessibility
- The part itself answers the keys above.
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| disabled | the prop disabled |
Motion
- The part sets its own motion: add no transition or animation of your own.
- How the theme moves, and how to move your own parts the same way: Motion.
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.