ナビゲーション
Tree
フォルダのように階層をたどれるツリー表示。枝の開閉や、矢印キーでの移動ができます。
ReactVueWeb Components
Storybook で見る プレイグラウンド
使用例
<Tree aria-label="ファイル" nodes={tree} defaultExpanded={['src']} onSelect={open} /> 設定できる項目
| 名前 | 型 | 既定値 | 説明 |
|---|---|---|---|
nodes 必須 | TreeNode[] | — | Root nodes. |
expanded | string[] | — | Controlled expanded ids. |
defaultExpanded | string[] | — | Initial expanded ids when uncontrolled. @default [] |
onExpandedChange | (ids: string[]) => void | — | Called with the expanded ids. |
selected | string | null | — | Controlled selected id. |
defaultSelected | string | null | — | Initial selected id when uncontrolled. @default null |
onSelect | (id: string) => void | — | Called with the selected id. |
aria-label | string | — | Accessible label for the tree. |
アクセシビリティ
- 文字と背景の明るさの差をしっかり取り、読みやすくしています。ライトでもダークでも、見やすさの国際基準 WCAG の最高ランク AAA(明るさの差が 7:1 以上)を満たします。
- マウスがなくても、キーボードだけですべての操作ができます。
- いまどこを操作しているかを示す枠(フォーカスの囲み)が、常にはっきり見えます。
- 利用者が「画面の動きを減らす」設定にしているときは、過剰なアニメーションを止めます。
どのコンポーネントも、だれにとっても使いやすいように、見やすさの国際基準 WCAG の最高ランク AAA(WCAG 2.1 AAA)を満たすよう作っています。