オーバーレイ
Popover
クリックで開く吹き出し型のパネル。タイトルと自由な中身を置けて、Escape キーや外側のクリックで閉じます。背景の操作はふさぎません。
ReactVueWeb Components
Storybook で見る プレイグラウンド
使用例
<Popover title="Info" content={<p>Details…</p>}>
<button>More</button>
</Popover> 設定できる項目
| 名前 | 型 | 既定値 | 説明 |
|---|---|---|---|
title | ReactNode | — | Optional header shown above the body. |
content 必須 | ReactNode | — | Popover body content. |
children 必須 | ReactElement<{ 'aria-expanded'?: boolean; 'aria-haspopup'?: 'dialog'; onClick?: (e: React.MouseEvent) => void; }> | — | The trigger element. It receives `aria-expanded`, `aria-haspopup`, and an onClick toggle; it must be a focusable element. |
open | boolean | — | Controlled open state. |
defaultOpen | boolean | false | Initial open state (uncontrolled). @default false |
onOpenChange | (open: boolean) => void | — | Called when open state changes. |
className | string | — |
アクセシビリティ
- 文字と背景の明るさの差をしっかり取り、読みやすくしています。ライトでもダークでも、見やすさの国際基準 WCAG の最高ランク AAA(明るさの差が 7:1 以上)を満たします。
- マウスがなくても、キーボードだけですべての操作ができます。
- いまどこを操作しているかを示す枠(フォーカスの囲み)が、常にはっきり見えます。
- 利用者が「画面の動きを減らす」設定にしているときは、過剰なアニメーションを止めます。
どのコンポーネントも、だれにとっても使いやすいように、見やすさの国際基準 WCAG の最高ランク AAA(WCAG 2.1 AAA)を満たすよう作っています。