フォーム
Number Input
数値を入力する欄に、増減ボタンを付けた部品。上下キーでの増減もそのまま使えます。
ReactVueWeb Components
Storybook で見る プレイグラウンド
使用例
<FormField label="数量"><NumberInput min={0} max={99} defaultValue={1} /></FormField> 設定できる項目
| 名前 | 型 | 既定値 | 説明 |
|---|---|---|---|
value | number | null | — | Controlled value (`null` when empty). |
defaultValue | number | null | — | Initial value when uncontrolled. |
onChange | (value: number | null) => void | — | Called with the new value (`null` when cleared). |
min | number | — | Minimum value. |
max | number | — | Maximum value. |
step | number | 1 | Step for the buttons and keyboard. @default 1 |
size | 'sm' | 'md' | 'lg' | md | Control size. @default 'md' |
decrementLabel | string | Decrease | Accessible label for the decrement button. @default 'Decrease' |
incrementLabel | string | Increase | Accessible label for the increment button. @default 'Increase' |
アクセシビリティ
- 文字と背景の明るさの差をしっかり取り、読みやすくしています。ライトでもダークでも、見やすさの国際基準 WCAG の最高ランク AAA(明るさの差が 7:1 以上)を満たします。
- マウスがなくても、キーボードだけですべての操作ができます。
- いまどこを操作しているかを示す枠(フォーカスの囲み)が、常にはっきり見えます。
- 利用者が「画面の動きを減らす」設定にしているときは、過剰なアニメーションを止めます。
どのコンポーネントも、だれにとっても使いやすいように、見やすさの国際基準 WCAG の最高ランク AAA(WCAG 2.1 AAA)を満たすよう作っています。