Copy button

A React component in Beamline's Actions category, in the free sample.

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

PropTypeDefaultDescription
valuestring—
labelstring"Copy"
iconOnlyboolean—
variantButtonVariant | "plain""secondary"
sizeButtonSize"sm"
onCopied() => void—
timeoutnumber1600
classNamesCopyButtonClassNames—
style / refCSSProperties / native Ref—native button

Dependencies

lucide-react, motion

Import

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 · Connect your agent

More in Actions

  • 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: 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: 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: 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: 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: 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…