フォーム
Pin Input
コードやワンタイムパスワードを 1 文字ずつ入れる欄。入力すると自動で次の欄へ進みます。
ReactVueWeb Components
Storybook で見る プレイグラウンド
使用例
<PinInput length={6} onComplete={verify} label="認証コード" /> 設定できる項目
| 名前 | 型 | 既定値 | 説明 |
|---|---|---|---|
length | number | 6 | Number of cells. @default 6 |
value | string | — | Controlled value. |
defaultValue | string | | Initial value when uncontrolled. @default '' |
onChange | (value: string) => void | — | Called with the current concatenated value on every change. |
onComplete | (value: string) => void | — | Called once all cells are filled. |
type | 'numeric' | 'text' | numeric | Restrict input and set the mobile keyboard. @default 'numeric' |
mask | boolean | false | Obscure entered characters (one-time passcodes). @default false |
size | 'sm' | 'md' | 'lg' | md | Control size. @default 'md' |
disabled | boolean | false | Disable all cells. @default false |
label | string | Digit | Base accessible label for each cell, suffixed by position. @default 'Digit' |
className | string | — |
アクセシビリティ
- 文字と背景の明るさの差をしっかり取り、読みやすくしています。ライトでもダークでも、見やすさの国際基準 WCAG の最高ランク AAA(明るさの差が 7:1 以上)を満たします。
- マウスがなくても、キーボードだけですべての操作ができます。
- いまどこを操作しているかを示す枠(フォーカスの囲み)が、常にはっきり見えます。
- 利用者が「画面の動きを減らす」設定にしているときは、過剰なアニメーションを止めます。
どのコンポーネントも、だれにとっても使いやすいように、見やすさの国際基準 WCAG の最高ランク AAA(WCAG 2.1 AAA)を満たすよう作っています。