← All components Layout & primitives
CopyButton
One-click copy with temporary feedback. clipboard.writeText with execCommand fallback for non-secure contexts.
Inspired by GitHub clipboard pattern; standard across docs sites.
Preview
What it looks like.
Usage
Drop it into your app.
import { CopyButton } from '@locara/components'
<CopyButton text={code} label="Copy" />
<CopyButton text={hash} variant="outlined" />
<CopyButton text={url} size="sm" />
// Lazy text resolution:
<CopyButton text={() => generateLink()} onCopied={(v) => console.log(v)} />
Or copy the source into your repo:
locara add copy-button