Copy Button

値をクリップボードにコピーし、短い「コピーしました」の確認を表示します。スクリーンリーダーにも読み上げられます。

対応フレームワーク
  • Angular: 対応
  • Vue: 対応
  • React: 対応
  • React Native: 対応

使い方

インポート

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

API リファレンス

SoneCopyButtonComponentコンポーネント

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.

セレクター
sone-copy-button
入力
名前型 デフォルト
value必須

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
出力
名前型
copied

The value reached the clipboard.

string
copyError

The clipboard refused the write.

unknown