npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-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';
function ApiKeyRow() {
const key = 'key_live_7Hq2xV9mK4tR8wN3cL6p';
return (
<div className="flex flex-col items-start gap-3">
<div className="flex w-full items-center gap-2">
<TextInput aria-label="API key" readOnly value={key} className="min-w-0 flex-1 text-ellipsis" />
<CopyButton value={key} label="Copy key" variant="outline" size="lg" />
</div>
<CopyButton value="https://example.com/invite/7f3a9c" label="Copy invite link" iconOnly size="md" />
</div>
);
}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>/meadow-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';
function ApiKeyRow() {
const key = 'key_live_7Hq2xV9mK4tR8wN3cL6p';
return (
<div className="flex flex-col items-start gap-3">
<div className="flex w-full items-center gap-2">
<TextInput aria-label="API key" readOnly value={key} className="min-w-0 flex-1 text-ellipsis" />
<CopyButton value={key} label="Copy key" variant="outline" size="lg" />
</div>
<CopyButton value="https://example.com/invite/7f3a9c" label="Copy invite link" iconOnly size="md" />
</div>
);
}- 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; a value shown in the theme's mono is a
CodeBlock, which has its own copy button. Never a Toast for the confirmation. - height, padding: 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 and its tooltip — 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 quiet IconButton; label names it and shows in its tooltip. |
| variant? | 'ghost' | 'outline' = 'ghost' | ghost (no fill at rest) or outline (the card fill: inside its 1 px grey edge at lg, the raised chip's soft drop at sm and md). |
| size? | 'sm' | 'md' | 'lg' = 'sm' | sm and md 28 px with words (24 and 28 px for the glyph alone), lg 40 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 |
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.