Copy Button
A click-to-copy button. Writes a value to the clipboard, then shows a check icon and swapped label for about 1.5 seconds before reverting. Fires a @copy callback after a successful copy.
Installation
Copy the piece into your app — it compiles with your build and the code is yours:
puzzle add piece copy-button
Requires the pieces.css tokens merged into your app styles (see Introduction).
Usage
import CopyButton from '@/components/ui/CopyButton.pzl';
<CopyButton value={ testKey } @copy={ onCopied }/>Icon-only
With a label
Variants
Sizes
Copying a code snippet
npm install @magic-spells/puzzle