オーバーレイ
Modal
背景の上に重ねて開く小窓(ダイアログ)。開いている間はキーボードの操作対象が小窓の中だけに収まり、迷わず使えます。
ReactVueWeb Components
Storybook で見る プレイグラウンド
使用例
<Modal open={open} onClose={close} title="Confirm" footer={<Button>OK</Button>}>
Are you sure?
</Modal> 設定できる項目
| 名前 | 型 | 既定値 | 説明 |
|---|---|---|---|
open 必須 | boolean | — | Whether the modal is open. |
onClose 必須 | () => void | — | Called when the modal requests to close (Escape, backdrop, close button). |
title | ReactNode | — | Dialog title (announced as the accessible name). |
footer | ReactNode | — | Footer content (e.g. action buttons). |
size | 'sm' | 'md' | 'lg' | md | Size. @default 'md' |
closeOnBackdrop | boolean | true | Close when the backdrop is clicked. @default true |
children 必須 | ReactNode | — | Body content. |
className | string | — |
アクセシビリティ
- 文字と背景の明るさの差をしっかり取り、読みやすくしています。ライトでもダークでも、見やすさの国際基準 WCAG の最高ランク AAA(明るさの差が 7:1 以上)を満たします。
- マウスがなくても、キーボードだけですべての操作ができます。
- いまどこを操作しているかを示す枠(フォーカスの囲み)が、常にはっきり見えます。
- 利用者が「画面の動きを減らす」設定にしているときは、過剰なアニメーションを止めます。
どのコンポーネントも、だれにとっても使いやすいように、見やすさの国際基準 WCAG の最高ランク AAA(WCAG 2.1 AAA)を満たすよう作っています。