- Docs
- Components
- Forms
File upload
Choose or drop files: a drop zone over the browser's own file input, each upload with its status.
- Import
- @qeetrix/react/experimental
- Status
- ExperimentalSince 0.0.6
- Renders
<input type="file">Server-rendered- Tested
- WCAG 2.2 AAaxe on every pull request
01
Drop or choose
A drop zone over a real file input. Files that pass go to onSelect; the rest are listed with the reason.
<Field label="SAML metadata">
<FileUpload accept=".xml" maxSize={1_000_000} items={items} onSelect={upload} onRemove={remove} />
</Field>02
Several files
multiple, and the hint written from accept and maxSize: "PNG, JPEG, up to 5 MB".
<Field label="Logos">
<FileUpload accept="image/png,image/jpeg" maxSize={5_000_000} multiple items={items} onSelect={upload} onRemove={remove} />
</Field>03
Every status
The app reports each file in items: uploading with its progress, done, or failed with why.
- users-march.csv
- users-feb.csvUploaded
- users-jan.csvNot uploaded
<FileUpload
accept=".csv"
items={[
{ id: "1", name: "users-march.csv", size: 482_000, status: "uploading", progress: 45 },
{ id: "2", name: "users-feb.csv", size: 391_000, status: "done" },
{ id: "3", name: "users-jan.csv", size: 2_400_000, status: "error", error: "Row 214: the email is missing." },
]}
onSelect={upload}
onRemove={remove}
/>