フォーム
File Upload
ファイルをドラッグ&ドロップで受け取り、選んだファイルの一覧も見せるアップロード欄。受け取り欄はキーボードからも開けます。
ReactVueWeb Components
Storybook で見る プレイグラウンド
使用例
<FileUpload multiple accept="image/*" onChange={setFiles} /> 設定できる項目
| 名前 | 型 | 既定値 | 説明 |
|---|---|---|---|
value | File[] | — | Controlled file list. |
defaultValue | File[] | — | Initial files when uncontrolled. @default [] |
onChange | (files: File[]) => void | — | Called with the updated file list. |
accept | string | — | `accept` attribute for the file input. |
multiple | boolean | false | Allow selecting multiple files. @default false |
disabled | boolean | false | Disable the control. @default false |
label | ReactNode | ファイルをドラッグ、またはクリックして選択 | Main dropzone label. @default 'ファイルをドラッグ、またはクリックして選択' |
hint | ReactNode | — | Secondary hint under the label. |
removeLabel | (name: string) => string | Remove ${name} | Builds the remove button label. @default `Remove ${name}` |
inputLabel | string | ファイルを選択 | Accessible name for the underlying file input. @default 'ファイルを選択' |
id | string | — | |
name | string | — | |
className | string | — |
アクセシビリティ
- 文字と背景の明るさの差をしっかり取り、読みやすくしています。ライトでもダークでも、見やすさの国際基準 WCAG の最高ランク AAA(明るさの差が 7:1 以上)を満たします。
- マウスがなくても、キーボードだけですべての操作ができます。
- いまどこを操作しているかを示す枠(フォーカスの囲み)が、常にはっきり見えます。
- 利用者が「画面の動きを減らす」設定にしているときは、過剰なアニメーションを止めます。
どのコンポーネントも、だれにとっても使いやすいように、見やすさの国際基準 WCAG の最高ランク AAA(WCAG 2.1 AAA)を満たすよう作っています。