Appearance
Upload
A drop zone that collects files, with one row per file showing each step of its upload.
components-dropzone--progressOpen in Storybook ↗When to use
- Adding media files, a CSV or an Excel file in an upload form or import flow.
- Uploading several files at once, where people need to see which file is where in the process.
When not to use
- Picking a record that already exists: use an autocomplete or dropdown.
- Pasting text or a link: use a text input.
Anatomy
- Zone: a dashed
--color-border-dashedborder,--radius-cardcorners and a white fill. Its minimum height is--dropzone-height-small,--dropzone-height-normal(default) or--dropzone-height-big; it grows with its rows. - Label: a real button with the field's prompt, such as Drag your files, or click here to add your files. Centred while the zone is empty; above the rows once it has files.
- File row:
--color-border-subtleborder; a file icon tile, the file name, its size in--color-text-light, one status glyph per step, and a remove button (trash icon). Rows are sorted by file name. - Status glyph: a small round step marker; its icon and colour show the status (see States). In a row it shows no text; its tooltip gives the status.
- Message lines (optional): warnings on
--color-warning-bgand errors on--color-danger-bgin--color-danger-ink, as a bulleted list under the row.
Outside the zone, the upload form shows a banner while files upload: {done} of {total} uploaded with a progress bar for the whole batch. Some flows also show the batch steps as labelled status pills.
Variants
| Variant | Steps in each row | Used for |
|---|---|---|
| Media upload | validate, prepare, upload | media files, alone or with a CSV |
| Validation file | validate | a CSV or Excel file that is checked first (dry run) |
| Reorder upload | upload | uploads that only reorder existing records |
| Step | Tooltips |
|---|---|
| Validate | No CSV, Validating CSV, OK, Error in CSV |
| Prepare | No mediafiles, Loading mediafiles, OK, Mismatch between mediafiles and CSV |
| Upload | Not uploading, Uploading, Uploaded, Something went wrong while uploading |
A media file's validate step turns complete as soon as the file is added. There is no percentage bar per file; a row shows which step a file is in.
States
Zone
| State | What you see | Trigger |
|---|---|---|
| Empty | dashed zone, label centred | — |
| Drag over | --color-accent border, --color-accent-wash fill | dragging files over the zone |
| With files | label at the top, one row per file | files added |
| Full | no change; drops and clicks are ignored | the maximum number of files is reached |
| Locked | no change; drops and clicks are ignored | the upload has finished |
Step glyph
| State | What you see | Trigger |
|---|---|---|
| Empty | outline circle on grey | step not started |
| Loading | spinning cog on teal | step in progress |
| Complete | green check on light green | step done |
| Failed | ban icon on red; the row gets a --color-danger border and an error list | step failed |
| Incomplete | image-plus icon on orange | mediafiles missing (not used in file rows) |
| Paused | pause icon on orange | upload paused (not used in file rows) |
base-baseprogressstep--all-statusesOpen in Storybook ↗Row messages
| Message | What you see | Trigger |
|---|---|---|
| Error | a bulleted list on --color-danger-bg in --color-danger-ink; the row gets a --color-danger border and the step a ban icon | a step failed |
| Warning | a bulleted list on --color-warning-bg; the row keeps its normal border and its steps still complete | the CSV check found something to look at, or the server accepted the file with a warning |
A file with a warning is uploaded; the warning is for the person to check afterwards.
Files beyond the maximum number are removed again straight away, without a message. Removing a file makes room again. A failed file keeps its row.
Keyboard & accessibility
| Key | Action |
|---|---|
| Tab | reaches the zone's label, then each row's remove button |
| Enter / Space | on the label: opens the file dialog; on a remove button: removes that file |
- Dragging is optional: the label is a native
<button>, and clicking an empty part of the zone also opens the file dialog. The dialog filters on the accepted file types. - Each row has a
role="progressbar"named by the file name. Its value is the number of steps done, and itsaria-valuetextis the status of the last step that changed, such as Uploading. - A row's error list is a
role="alert". A warning list has no role, so it is not announced. - The remove button is named Remove file; the name does not include the file name.
- The status glyphs carry their status only in a
titletooltip, which pointer users see on hover. - The loading cog keeps spinning when reduced motion is requested.
- The upload banner is a
role="status", so each new count is announced.
Content
- The label says both ways in: drag, or click. Use the field's configured prompt, such as Drag your files, or click here to add your files.
- Error lines name the file or row and the problem: scan-003.tiff is missing, 2 row(s) could not be updated, see the details on the file.
- Warning lines say what to check, not that something failed: the file is uploaded.
- Translation keys:
upload-fields.labels.*,upload-fields.errors.*,upload-fields.remove-file,upload-fields.uploaded-ofandactions.progress-steps.*.
Related
Loading · Button · Tooltip · Accessibility