Copy Button
Copiez une valeur dans le presse-papiers avec une brève confirmation « Copié » que les lecteurs d’écran entendent aussi.
Disponible pour
Angular: disponible Vue: disponible React: disponible React Native: disponible
Utilisation
<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>Importation
import {
SoneCopyButtonComponent,
} from "@surface-one/angular/copy-button";Référence de l’API
SoneCopyButtonComponentComposant
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.
| Nom | Type | Par défaut |
|---|---|---|
valueobligatoireThe 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 |
| Nom | Type |
|---|---|
copiedThe value reached the clipboard. | string |
copyErrorThe clipboard refused the write. | unknown |