Overview
Use FileUpload to collect one or more files when people need clear format, size, count, selection, and rejection feedback.
Security evidence
Use the picker to add files and confirm constraints before upload.
- security-review.pdf21 B
Anatomy
FileUpload combines a picker and drop target with constraints, accepted file identity, metadata, and removal.
- 1Upload visual
Identifies file collection or current processing.
- 2Instruction
Names dropping and browsing as equivalent paths.
- 3Constraints
States accepted formats, size, and count before selection.
- 4Selected file
Shows file name and useful metadata.
- 5Remove control
Removes one file from the controlled collection.
When to use
Use FileUpload when a workflow requires local files and people must review the selected collection before submission.
Recommended
- Collect evidence or attachments
Support documents, images, exports, and governed artifacts.
- Validate before upload
Reject unsupported type, size, duplicates, and excess count immediately.
- Show selected identity
Let people confirm and remove each file before submission.
When not to use
Use another pattern when content already exists remotely or needs specialized capture and editing.
Avoid
- Do not browse remote assets
Use a file picker or asset browser for existing repository content.
- Do not capture camera media implicitly
Use a dedicated capture flow with permissions and preview.
- Do not hide upload progress
Use Progress for long-running transfer and processing stages.
Variants
Drop-zone treatment and size adapt file collection to page-level tasks and compact form regions.
Outlined
Dashed default drop target.
Filled
Tonal drop zone for grouped forms.
Raised
Elevated collection surface.
Sizes
Small, medium, and large scale target and file rows.
States
FileUpload separates selection, validation, and application-owned transfer progress.
| State | Trigger | Visual response | Interaction |
|---|---|---|---|
| Empty | No accepted files | Instruction and constraints | Browse or drop |
| Drag active | Files enter target | Primary border and ring | Drop to validate |
| Selected | Files pass validation | Named removable rows | Add or remove |
| Rejected | Validation fails | Assertive specific messages | Choose valid files |
| Loading | Upload or processing active | Progress visual and label | Selection disabled |
| Disabled | Collection unavailable | Reduced emphasis | Not operable |
Behavior
FileUpload owns local selection and validation while applications own transfer, persistence, virus scanning, retries, and server policy.
Collection
Picker and drop paths run the same validation pipeline.
Validation
Type, size, count, and duplicate rules produce specific rejections.
Removal
A named action removes one accepted file.
Transfer boundary
Accepted files are returned; network upload remains application-owned.
Accessibility
The drop zone is a real button backed by a native file input; every operation remains available without drag-and-drop.
| Key | Action |
|---|---|
| Tab | Moves to the drop zone or a remove control. |
| EnterSpace | Opens the native file picker or removes the focused file. |
- Never require drag-and-drop; retain a keyboard-operable picker.
- State accepted types, maximum size, and maximum count before selection.
- Announce rejection messages with the file name and corrective constraint.
- Give every remove control a label containing the file name.
- Do not claim upload completion when files are only locally selected.
- Expose transfer progress separately for long uploads.
Content guidelines
Upload guidance should answer what, how many, and how large before people open the picker.
Name both paths
Treat browse and drop as equivalent.
Drop files here or browse
List formats
Use recognizable format names.
PDF or Word documents
State limits
Include per-file size and total count.
Up to 10 MB each. Maximum 5 files.
Write specific rejection
Name the file and failed rule.
report.exe is not an accepted file type.
Examples
Controlled files and loading state support application-owned submission and processing.
Processing state
- security-review.pdf21 B
Props / API
FileUpload extends div attributes and exposes accepted files plus typed rejection codes.
Props