フォーム

Tree Select

ツリー構造からノードを選ぶセレクト。トリガーを押すとパネルが開き、矢印キーで移動し、Enter で選び、Escape で閉じます。

ReactVueWeb Components
Storybook で見る

プレイグラウンド

使用例

<TreeSelect
  aria-label="カテゴリ"
  nodes={categories}
  placeholder="選択してください"
  onChange={setCategory}
/>

設定できる項目

名前 既定値 説明
nodes 必須 TreeNode[] Tree data.
value string | string[] | null Controlled selected node id(s).
defaultValue string | string[] | null Initial selection when uncontrolled. @default null (single) / [] (multiple)
onChange (value: string | null) => void Called with the selected id or id array.
multiple boolean false Allow selecting multiple nodes. @default false
placeholder string Placeholder shown when nothing is selected.
disabled boolean false Disable the trigger. @default false
size 'sm' | 'md' | 'lg' md Control size. @default 'md'
aria-label string Accessible label (when not inside a FormField).
id string
className string

アクセシビリティ

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

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