Unreviewed<ButtonCopy copy="npm i @antadesign/anta" label="Copy install" />
<ButtonCopy copy="https://anta.design" /> // icon-only
<ButtonCopy copy={code} label="Copy" iconPlacement="trailing" />
<ButtonCopy copy={code} label="Copy snippet" iconPlacement="none" copiedLabel="Copied" />
<ButtonCopy copyNode=".snippet" label="Copy block" priority="tertiary" />
<ButtonCopy copyUrl label="Copy link" /> // copies location.href
Copy button — a
Buttonpreset for copy-to-clipboard. Setcopyfor a literal string,copyNodeto copy a DOM region, orcopyUrlto copy the current page URL. For dynamic text, pass a controlledcopystring and set it inonCopyRequestbefore activation.It composes a plain
<Button>with a slotted<a-copy>child that performs the write — the button itself carries no copy behavior. This wrapper flips the copy glyph to a check (success) or ✕ (failure) and retones tosuccess/criticalfor ~2s (a re-render, no element state — seeuseCopyFeedback).iconPlacementputs that glyph leading (default), trailing, or'none'; with'none',<a-copy>shows itsCopiedconfirmation instead.With a
labelit's a labeled button; without one it's an icon-only copy button (named "Copy" for assistive tech). Everything else is a normalButtonprop —tone,priority,size,icon(the resting glyph),onCopied.