Copy Button

Copia un valore negli appunti con una breve conferma «Copiato» che sentono anche i lettori di schermo.

Disponibile in
  • Angular: disponibile
  • Vue: disponibile
  • React: disponibile
  • React Native: disponibile

Utilizzo

Importazione

ts
import {
  SoneCopyButtonComponent,
} from "@surface-one/angular/copy-button";

Riferimento API

SoneCopyButtonComponentComponente

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.

Selettore
sone-copy-button
Input
NomeTipo Predefinito
valueobbligatorio

The text that goes to the clipboard.

string—
label—$localize`Copy`
copiedLabel—$localize`Copied`
variantButtonVariant"outline"
size

Default: `sm`, or `icon-sm` when `iconOnly`.

ButtonSize | nullnull
iconOnly

Only the glyph; `label` / `copiedLabel` become its accessible name.

booleanfalse
disabledbooleanfalse
resetAfter

How long the "Copied" state lasts, in ms.

number1500
Output
NomeTipo
copied

The value reached the clipboard.

string
copyError

The clipboard refused the write.

unknown