Copy Button
Copy a value to the clipboard with a brief “Copied” confirmation that screen readers hear too.
Available in
Angular: available Vue: available React: available React Native: available
Usage
<div class="demo-row" style="align-items: center">
<sone-copy-button value="npm install @surface-one/angular" />
<sone-copy-button value="mtg_01J9ZK3Q7R4M2" label="Copy meeting ID" iconOnly variant="ghost" />
<sone-copy-button value="{ "mcpServers": {} }" label="Copy config" variant="secondary" />
</div>Import
import {
SoneCopyButtonComponent,
} from "@surface-one/angular/copy-button";API reference
SoneCopyButtonComponentComponent
Copies `value` to the clipboard from the click handler (nothing runs on the server), swaps to a "Copied" state for `resetAfter` ms and announces it in a polite live region.
| Name | Type | Default |
|---|---|---|
valuerequiredThe text that goes to the clipboard. | string | — |
label | — | $localize`Copy` |
copiedLabel | — | $localize`Copied` |
variant | ButtonVariant | "outline" |
sizeDefault: `sm`, or `icon-sm` when `iconOnly`. | ButtonSize | null | null |
iconOnlyOnly the glyph; `label` / `copiedLabel` become its accessible name. | boolean | false |
disabled | boolean | false |
resetAfterHow long the "Copied" state lasts, in ms. | number | 1500 |
| Name | Type |
|---|---|
copiedThe value reached the clipboard. | string |
copyErrorThe clipboard refused the write. | unknown |