フォーム

Tag Input

メールアドレスやキーワードを、タグとして複数まとめて入力できる欄。Enter か区切り文字で追加し、空欄で Backspace を押すと直前のタグを消します。

ReactVueWeb Components
Storybook で見る

プレイグラウンド

使用例

<FormField label="宛先"><TagInput defaultValue={['ada@example.com']} /></FormField>

設定できる項目

名前 既定値 説明
value string[] Controlled list of tags.
defaultValue string[] Initial tags when uncontrolled. @default []
onChange (tags: string[]) => void Called with the updated tag list.
placeholder string Placeholder for the text field.
delimiters string[] Keys (besides Enter) that commit the current text. @default [',']
unique boolean true Reject duplicate tags. @default true
disabled boolean false Disable adding/removing. @default false
aria-label string Accessible label for the group/field.
removeLabel (tag: string) => string Remove ${tag} Builds the remove button label for a tag. @default `Remove ${tag}`
id string
className string

アクセシビリティ

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

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