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

Importation

ts
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.

Sélecteur
sone-copy-button
Inputs
NomType Par défaut
valueobligatoire

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
Outputs
NomType
copied

The value reached the clipboard.

string
copyError

The clipboard refused the write.

unknown