Copy Button
Kopiowanie wartości do schowka z krótkim potwierdzeniem „Skopiowano”, które słyszą też czytniki ekranu.
Dostępny w
Angular: dostępny Vue: dostępny React: dostępny React Native: dostępny
Użycie
<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";Dokumentacja API
SoneCopyButtonComponentKomponent
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.
| Nazwa | Typ | Domyślnie |
|---|---|---|
valuewymaganeThe 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 |
| Nazwa | Typ |
|---|---|
copiedThe value reached the clipboard. | string |
copyErrorThe clipboard refused the write. | unknown |