Skip to content

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 ​

Anatomy ​

  1. Zone: a dashed --color-border-dashed border, --radius-card corners and a white fill. Its minimum height is --dropzone-height-small, --dropzone-height-normal (default) or --dropzone-height-big; it grows with its rows.
  2. 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.
  3. File row: --color-border-subtle border; 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.
  4. 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.
  5. Message lines (optional): warnings on --color-warning-bg and errors on --color-danger-bg in --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 ​

VariantSteps in each rowUsed for
Media uploadvalidate, prepare, uploadmedia files, alone or with a CSV
Validation filevalidatea CSV or Excel file that is checked first (dry run)
Reorder uploaduploaduploads that only reorder existing records
StepTooltips
ValidateNo CSV, Validating CSV, OK, Error in CSV
PrepareNo mediafiles, Loading mediafiles, OK, Mismatch between mediafiles and CSV
UploadNot 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

StateWhat you seeTrigger
Emptydashed zone, label centred—
Drag over--color-accent border, --color-accent-wash filldragging files over the zone
With fileslabel at the top, one row per filefiles added
Fullno change; drops and clicks are ignoredthe maximum number of files is reached
Lockedno change; drops and clicks are ignoredthe upload has finished

Step glyph

StateWhat you seeTrigger
Emptyoutline circle on greystep not started
Loadingspinning cog on tealstep in progress
Completegreen check on light greenstep done
Failedban icon on red; the row gets a --color-danger border and an error liststep failed
Incompleteimage-plus icon on orangemediafiles missing (not used in file rows)
Pausedpause icon on orangeupload paused (not used in file rows)
base-baseprogressstep--all-statusesOpen in Storybook ↗

Row messages

MessageWhat you seeTrigger
Errora bulleted list on --color-danger-bg in --color-danger-ink; the row gets a --color-danger border and the step a ban icona step failed
Warninga bulleted list on --color-warning-bg; the row keeps its normal border and its steps still completethe 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 ​

KeyAction
Tabreaches the zone's label, then each row's remove button
Enter / Spaceon 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 its aria-valuetext is 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 title tooltip, 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-of and actions.progress-steps.*.

Loading · Button · Tooltip · Accessibility

Powered by Elody - Open Source Semantic Data Platform