# Copy button

A React component in [Beamline](https://beamline.io/)'s [Actions](https://beamline.io/components/actions) category, in the free sample. Live demo: https://beamline.io/components/copy-button

Copies a value and confirms in place: the icon becomes a check and the label says Copied; a refused copy says so instead of pretending.

## Use it for

- Copying a key, an id, a URL or a code snippet with visible confirmation.

## Not for

- Copying whole documents or files (offer a download).

## Anatomy

- Button
- icon (copy → check / x)
- label
- live status for screen readers

## Variants

- **variant**: secondary (default), outline, ghost, plain (alias of ghost), primary
- **size**: sm, md, lg

## States

- idle
- copied (1.6 s)
- failed
- disabled

## Keyboard

- Enter / Space copies

## Motion

Icon feedback uses --pui-duration-feedback (existing 160ms default); reduced/none swaps instantly. Copy result timeout is reading time and does not scale with animation speed.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string` | — |  |
| `label` | `string` | `"Copy"` |  |
| `iconOnly` | `boolean` | — |  |
| `variant` | `ButtonVariant \| "plain"` | `"secondary"` |  |
| `size` | `ButtonSize` | `"sm"` |  |
| `onCopied` | `() => void` | — |  |
| `timeout` | `number` | `1600` |  |
| `classNames` | `CopyButtonClassNames` | — |  |
| `style / ref` | `CSSProperties / native Ref` | — | native button |

## Dependencies

`lucide-react`, `motion`

## Import

```tsx
import { CopyButton } from "@/components/copy-button/copy-button";
```

## Get it

Copy button is part of Beamline: 190 React components and screens your coding agent (Claude Code, Codex, Cursor or any MCP client) installs into your app through Beamline's MCP server, as a ready-built package or as plain React source you can change. $49 one payment (regular $200), no subscription, a year of updates, one licence for your whole team. Copy button is in the free sample, which costs nothing. [Get Beamline](https://beamline.io/checkout?pack=complete) · [Connect your agent](https://beamline.io/connect)

## More in Actions

- [Button](https://beamline.io/components/button): The action control: five weights and a brand fill, a buy/sell tone, sm/md/lg and a 44 px touch size, icon-only, a loading state that keeps its size and…
- [Confirm morph](https://beamline.io/components/confirm-morph): A destructive action that asks in place: the button morphs into its question, then into working, then into the result with Undo or Retry, without a dialog.
- [Hold to confirm](https://beamline.io/components/hold-to-confirm): Confirms a costly action by holding instead of clicking: a fill sweeps across while held and drains if let go early; pointer, touch, Space and Enter all…
- [Split button](https://beamline.io/components/split-button): One obvious action joined to a menu of close alternatives; both halves are real buttons and the menu uses the shared menu rows.
- [Swipe actions](https://beamline.io/components/swipe-actions): Row actions behind a swipe on touch screens, mirrored in a menu at the row's end for pointer and keyboard; a full swipe runs the edge action.
- [Theme switch](https://beamline.io/components/theme-switch): The light/dark control: the page changes in one of four transitions starting from the button (reveal, eclipse, split, rise), and the icon turns between…
