アクション
Copy Button
押すと value の文字列をクリップボードにコピーし、チェックマークで成功を知らせるボタン。アイコンだけでも、label を添えて文字付きでも使えます。コピーが済むと、読み上げソフトにも「コピーしました」と伝わります。
ReactVueWeb Components
Storybook で見る プレイグラウンド
使用例
<CopyButton value="--lily-color-primary-100" />
<CopyButton value={code} label="Copy" /> 設定できる項目
| 名前 | 型 | 既定値 | 説明 |
|---|---|---|---|
value 必須 | string | — | The text written to the clipboard on click. |
label | ReactNode | — | Visible label beside the icon. Omit for an icon-only button. |
copyLabel | string | Copy | Accessible name (used as `aria-label`, esp. when icon-only). @default 'Copy' |
copiedLabel | string | Copied | Announced and shown briefly after a successful copy. @default 'Copied' |
size | 'sm' | 'md' | md | Control size. @default 'md' |
onCopy | (value: string) => void | — | Called with the copied value after a successful copy. |
className | string | — |
アクセシビリティ
- 文字と背景の明るさの差をしっかり取り、読みやすくしています。ライトでもダークでも、見やすさの国際基準 WCAG の最高ランク AAA(明るさの差が 7:1 以上)を満たします。
- マウスがなくても、キーボードだけですべての操作ができます。
- いまどこを操作しているかを示す枠(フォーカスの囲み)が、常にはっきり見えます。
- 利用者が「画面の動きを減らす」設定にしているときは、過剰なアニメーションを止めます。
どのコンポーネントも、だれにとっても使いやすいように、見やすさの国際基準 WCAG の最高ランク AAA(WCAG 2.1 AAA)を満たすよう作っています。