フォーム
Combobox
入力しながら候補を絞り込めるテキスト欄。上下キーで候補を選び、Enter で決定します。
ReactVueWeb Components
Storybook で見る プレイグラウンド
使用例
<Combobox aria-label="国" options={countries} onChange={setCountry} /> 設定できる項目
| 名前 | 型 | 既定値 | 説明 |
|---|---|---|---|
options 必須 | ComboboxOption[] | — | Selectable options. |
value | string | null | — | Controlled selected value (`null` = none). |
defaultValue | string | null | — | Initial value when uncontrolled. @default null |
onChange | (value: string | null) => void | — | Called with the newly selected value (`null` when cleared). |
placeholder | string | — | Field placeholder. |
disabled | boolean | false | Disable the control. @default false |
emptyText | string | No matches | Text shown when no options match. @default 'No matches' |
size | 'sm' | 'md' | 'lg' | md | Control size. @default 'md' |
filter | (option: ComboboxOption, query: string) => boolean | — | Custom filter predicate. @default case-insensitive label `includes`. |
aria-label | string | — | Accessible label (when not wrapped in a FormField). |
id | string | — | |
name | string | — | |
className | string | — |
アクセシビリティ
- 文字と背景の明るさの差をしっかり取り、読みやすくしています。ライトでもダークでも、見やすさの国際基準 WCAG の最高ランク AAA(明るさの差が 7:1 以上)を満たします。
- マウスがなくても、キーボードだけですべての操作ができます。
- いまどこを操作しているかを示す枠(フォーカスの囲み)が、常にはっきり見えます。
- 利用者が「画面の動きを減らす」設定にしているときは、過剰なアニメーションを止めます。
どのコンポーネントも、だれにとっても使いやすいように、見やすさの国際基準 WCAG の最高ランク AAA(WCAG 2.1 AAA)を満たすよう作っています。