Components · Forms · Upload
Back to Upload typesUpload
Use for adding one or more files to a form - either a large drag-and-drop dropzone or a compact trigger button, paired with a file list that reports each file's name, size and upload status - one Upload component, controlled by properties, not separate widgets glued together.
Properties
Label and helper text are properties of the same component, not separate fields - change them below to check this control's style and states in the Live Preview.
Live Preview
Both types compared side by side, each in all 10 states, using the chosen label and helper text. Dragging looks the same for Button as Hover, since there is no dropzone area to drag a file onto. Real drag-and-drop, file validation and upload progress wiring are a larger feature and are not built in this static preview.
When to use
Any form flow that needs the user to add one or more files, with clear feedback on what was added and whether it uploaded successfully.
Validation
Upload has three distinct failure modes, and each needs its own timing and its own message - lumping them into one generic "Upload failed" tells the user nothing about what to change or whether their other files are still safe.
- Required marking - if at least one file is required before submit, mark the field the same way any other required field is marked, and keep submit disabled (or the first submit attempt blocked with an inline message) until a file is present - don't let the user reach a server-side rejection for something the form already knew.
- Validation timing - type and size are both knowable the instant a file is selected or dropped, so check both before any upload attempt starts. Never let a doomed upload begin just to fail later - that wastes the user's time and bandwidth for an error the client already had the information to catch.
- Wrong file type - reject on selection/drop, not after. Show the message inline on that file's own row, not a top-of-page banner, and name the file and what it actually is: "PDF, PNG or JPG only - invoice-scan.heic is a .heic file." The row never enters the list as if it were queued to upload.
- File too large - also reject on selection, before any transfer starts: "invoice-scan.pdf is 42 MB - the limit is 25 MB." Don't rely on this row-level message alone - state the size limit up front near the dropzone (in the helper text or a caption), so most oversized files are ruled out before the user even picks one.
- Network failure mid-upload - the one failure that can't be caught before the transfer starts. Move that file's row to a distinct error state instead of letting it silently disappear or silently retry - "Upload interrupted - check your connection and try again," with a Retry action scoped to that row alone. Retrying one failed file must never re-trigger or disturb files that already finished successfully.
Component Guide
Overview
Upload adds one or more files to a form - either a large drag-and-drop dropzone or a compact trigger button - paired with a file list that reports each file's name, size, and upload status, so the user always knows what was added and whether it succeeded.
When to Use
- Attaching documents to a record - a support ticket, an application form.
- Uploading a profile photo or design asset - a single-file, often image-specific upload.
- Bulk file import - a CSV import, a batch of resumes/CVs.
When Not to Use
- Collecting a URL to an already-hosted file rather than the file itself - use Input or Add-on instead.
- A field that doesn't actually involve a file - obviously use a different form field type - Upload exists specifically for file transfer.
- A single, tiny, purely decorative image with no need for status feedback - a simpler custom control may be lighter weight than the full Upload component.
Best Practices
- Always show per-file progress and a clear success/error state, not just a single overall spinner.
- State accepted file types and size limits up front, before the user picks a file, not only after a rejected upload.
- Let the user remove a file from the list before final submission, in case they attached the wrong one.
Do and Don't
Do
Drop files or browse
PDF or PNG, up to 10 MB each
Accepted formats and the size ceiling are stated before the user picks a file, and each upload reports its own outcome.
Don't
Drop files or browse
Withholding the rules until after the upload wastes the user's time and bandwidth, and "Upload failed" still does not tell them what to change.
Accessibility
- The dropzone is also operable via a real file-picker trigger, since drag-and-drop alone isn't reachable by keyboard.
- Upload progress and completion/error status are announced via an aria-live region, not just shown visually.
- Each file row's remove control is independently labeled with that file's name ("Remove report.pdf"), not a generic "Remove" repeated for every row.
Related Components
Input, Progress, Result.
{
"component": "Upload",
"category": "Forms",
"summary": "Upload adds one or more files to a form - either a large drag-and-drop dropzone or a compact trigger button - paired with a file list that reports each file's name, size, and upload status, so the user always knows what was added and whether it succeeded.",
"whenToUse": [
"Attaching documents to a record - a support ticket, an application form.",
"Uploading a profile photo or design asset - a single-file, often image-specific upload.",
"Bulk file import - a CSV import, a batch of resumes/CVs."
],
"whenNotToUse": [
"Collecting a URL to an already-hosted file rather than the file itself - use Input or Add-on instead.",
"A field that doesn't actually involve a file - obviously use a different form field type - Upload exists specifically for file transfer.",
"A single, tiny, purely decorative image with no need for status feedback - a simpler custom control may be lighter weight than the full Upload component."
],
"bestPractices": [
"Always show per-file progress and a clear success/error state, not just a single overall spinner.",
"State accepted file types and size limits up front, before the user picks a file, not only after a rejected upload.",
"Let the user remove a file from the list before final submission, in case they attached the wrong one."
],
"doAndDont": {
"do": "Accepted formats and the size ceiling are stated before the user picks a file, and each upload reports its own outcome.",
"dont": "Withholding the rules until after the upload wastes the user's time and bandwidth, and \"Upload failed\" still does not tell them what to change."
},
"accessibility": [
"The dropzone is also operable via a real file-picker trigger, since drag-and-drop alone isn't reachable by keyboard.",
"Upload progress and completion/error status are announced via an aria-live region, not just shown visually.",
"Each file row's remove control is independently labeled with that file's name (\"Remove report.pdf\"), not a generic \"Remove\" repeated for every row."
],
"relatedComponents": [
"Input",
"Progress",
"Result"
]
}