File upload
Pick a file, and show chosen files as rows with size and progress.
{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}
Pick a file, and show chosen files as rows with size and progress.
Import
import { formatBytes, FileUploadItem, FileUpload } from "@ir/ui";Props
| Prop | Type | Required | What it does |
|---|---|---|---|
size | number | Bytes. Rendered with formatBytes. | |
progress | number | 0–100 while uploading; omit when done. |
Do and don't
Set accept and name the format and size limit in the hint — 'CSV, up to 10 MB'.
Don't — Leave the accepted format to trial and error.
The picker greys out wrong types, but nothing says why. People need the rule before they go looking.
Render a FileUploadItem per file, with its size and a remove button.
Don't — Show only a count once files are chosen.
'3 files' cannot be checked. Rows let people spot the wrong one and take it out.
Let FileUploadItem say Cancel while progress is running and Remove after.
Don't — Use the same word for stopping an upload and removing a finished file.
They have different consequences, and the button's name is what a screen reader announces.
Accessibility
- The native file input stays in the page (visually hidden), labelled by the whole field — so keyboard, accept filtering and form submission all behave natively.
- Upload progress is a progressbar named 'Uploading <file>' with aria-valuenow.
Where it is drawn
Figma — structure from figma, measurements from figma.