オーバーレイ

Drawer

画面の端から現れるパネル。種類は 3 つ。temporary(既定)は背景を覆って前面に開き、開いている間はキーボードの操作対象をパネルの中だけに収めます(Modal と同じ作りです)。persistent はページの中身と一緒に並び、開閉に合わせて隣の中身を左右に押し広げます。permanent は常に開いたままで、デスクトップのサイドバーなどに向いています。広い画面では permanent、狭い画面では temporary に切り替える使い方がよくあります。

ReactVueWeb Components
Storybook で見る

プレイグラウンド

使用例

<Drawer open={open} onClose={close} anchor="left" title="Menu">…</Drawer>
<Drawer variant="permanent" anchor="left" ariaLabel="Sections">…</Drawer>

設定できる項目

名前 既定値 説明
open boolean false Whether the drawer is open. Required for `temporary`/`persistent`; ignored for `permanent` (always shown). @default false
onClose () => void Called when the drawer requests to close (Escape / backdrop — temporary).
variant DrawerVariant temporary Relationship to the page. @default 'temporary'
anchor DrawerAnchor left Edge to anchor to. @default 'left'
title ReactNode Visible title; also becomes the dialog's accessible name (temporary).
ariaLabel string Accessible name when there is no visible `title` (e.g. a navigation drawer). Applied as `aria-label`.
children 必須 ReactNode Drawer content.
className string

アクセシビリティ

  • 文字と背景の明るさの差をしっかり取り、読みやすくしています。ライトでもダークでも、見やすさの国際基準 WCAG の最高ランク AAA(明るさの差が 7:1 以上)を満たします。
  • マウスがなくても、キーボードだけですべての操作ができます。
  • いまどこを操作しているかを示す枠(フォーカスの囲み)が、常にはっきり見えます。
  • 利用者が「画面の動きを減らす」設定にしているときは、過剰なアニメーションを止めます。

どのコンポーネントも、だれにとっても使いやすいように、見やすさの国際基準 WCAG の最高ランク AAA(WCAG 2.1 AAA)を満たすよう作っています。