structyl

Copy Button

stable

Copies text to the clipboard with success feedback.

Basic usage

npx structyl init

Examples

In a code block

Pair CopyButton with a styled code block — the typical documentation pattern.

pnpm add @structyl/styled

Copy command and tokens

CopyButton can be used beside code, API keys and generated theme values.

pnpm add @structyl/styled

Features

  • Animated check feedback.
  • Configurable reset delay.

Installation

bash
pnpm dlx structyl add copy-button

API Reference

CopyButton

Copies text to the clipboard with success feedback.

PropTypeDefault
valuestring

The text to copy.

resetAfternumber

Time before the icon resets (ms).

2000
onCopied(value: string) => void

Called after a successful copy.

Copy Button | structyl