FORMA Docs

Copy button

Copy a value with immediate confirmation.

import { CopyButton } from "@/forma/arc/copy-button/copy-button";
Base

In FORMA

  • Liegt in kit/arc/copy-button und ist über @/forma/arc/copy-button/copy-button erreichbar.
  • Farbe, Ecken, Höhen, Abstände, Tiefe, Schrift und Tempo kommen aus der Richtung (core/arc-bridge.ts); Arc behält Verhalten, Tastatur und Federn.

When to use

  • Next to API keys, install commands, links, or code snippets.
  • Icon-only copy controls in dense rows, with an accessible label.
  • Any copy action that should confirm Copied or Could not copy in place.

When not to use

  • Use split-button when copying has alternatives, such as Copy link and Copy as Markdown.
  • Use code-block for full code samples, which include their own copy control.

Usage

import { CopyButton } from "@/forma/arc/copy-button/copy-button";

export function ApiKeyRow({ apiKey }: { apiKey: string }) {
  return (
    <div className="row">
      <code>{apiKey}</code>
      <CopyButton value={apiKey} label="Copy key" iconOnly />
    </div>
  );
}

API reference

CopyButton

Copies a string to the clipboard and crossfades its icon and label to Copied or Failed.

PropTypeDefaultDescription
value (required)string–The text to copy.
labelstring"Copy"Idle label and accessible name.
iconOnlybooleanfalseHides the text and shows only the icon.
variant"outline" | "plain""outline"Bordered or borderless.
disabledboolean–Disables the button.
onCopied() => void–Called after a successful copy.
classNamestring–Extra class on the button.

Keyboard interactions

KeysAction
Enter / SpaceCopies the value.

Accessibility

  • Native button named by label, including when iconOnly.
  • A polite role="status" region announces "<label>: Copied" or "<label>: Could not copy".
  • The label cell reserves the widest of its three states, so the layout never shifts.

Motion

  • The old icon and word fade out in about 100ms while the new ones fade in over about 160ms, with no blur; the check draws its stroke in.
  • The label changes as one word, never letter by letter, and the same crossfade plays when it resets.
  • Reduced motion swaps icon and text with an instant fade and skips the stroke draw.

Responsive behavior

  • The label reserves the width of its widest state, so the button never shifts its neighbours when it changes.
  • It sizes to max-content with max-width 100%, so it stays compact in narrow rows.

Performance

  • Each copy is one short crossfade of the icon and the word (about 160ms) plus a quick stroke draw on the check; nothing animates per letter.
  • Clipboard access is async and needs a secure context; failures show the Failed state rather than throwing.

Notes for AI

  • Use next to any copyable value: API keys, install commands, links, code. For a copy action that also has alternatives use split-button.
  • Named export only; there is no default export.
  • Clipboard state and reset timing come from lib/use-copy-feedback, so copy that file along with the component.

Also in buttons

  • Button group: Related actions joined into one surface with hairline dividers: a hover highlight glides between segments, the pressed one answers in place, and an attached menu can close the row.
  • Floating button group: Separate soft buttons in a quiet tray, with one shared highlight that morphs from button to button as you move, and a pressed state that settles in place.
  • Expanding button group: Icon buttons in a compact group: the one you point at or focus grows to reveal its label while its neighbours slide aside, and an action confirms in place.
  • Icon morph: Icons that morph between states: menu to close, play to pause, copy to check, and more.
  • Confirm morph: A destructive button that morphs into an inline confirmation, a spinner, and a result with undo.

Guidance for AI tools

Copy button: Copy a value with immediate confirmation. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://uiarc.dev/llms.txt

Komponente und Text: Arc UI (MIT, uiarc.dev), angepasst für FORMA.