Skip to content

File Upload

The File Upload component allows users to select and upload files via click-to-browse or drag & drop. It supports three layout variants — a general-purpose drag zone, an image-specific uploader, and a profile photo uploader — along with built-in validation for file size, file type, and maximum file count. Upload progress is simulated with a visual progress bar, and files can be cancelled or retried on failure.

Loading Code Block...

The default configuration renders a drag & drop zone that accepts a single file of any type, with a 5 MB size limit.

Loading Code Block...

Three layout variants are available via the variant prop.

VariantDescription
dragGeneral-purpose drop zone with file list, progress bars, and status icons.
imageOptimised for image uploads with a visual preview of the selected image.
profileCircular avatar-style uploader for profile photos.

Set disabled to prevent file selection and drag & drop interactions. The component receives reduced opacity and cursor-not-allowed.

Use the accept prop to restrict which file types can be uploaded. The component provides predefined categories that map to MIME types and extensions:

Accept valueAllowed extensions
"all"Any file type
"image".jpg, .jpeg, .svg, .png, .gif, .webp
"document".doc, .docx, .xls, .xlsx, .ppt, .pptx
"pdf".pdf
"video".mp4, .mov, .avi, .mkv, .webm

Enable multi-file uploads with the multiple prop. Use maxFiles to cap the number of files allowed.

Loading Code Block...

The drag variant includes a full upload lifecycle with visual feedback:

1. User selects or drops files
2. Validation (file size, file type, max count)
┌─── PASS ───┐ ┌─── FAIL ───┐
↓ ↓ ↓ ↓
3. Progress bar 4. Error state
animates (red border,
↓ retry icon)
↓ ↓
5. Completed 6. Retry or
(green ✓) Remove
  • Progress: Simulated upload progress with a progress bar and file size indicator.
  • Success: Green border, check icon, “Completed” label.
  • Error: Red border, alert icon, error message, with retry and delete options.
  • Cancel: In-progress uploads can be cancelled by clicking the close icon.

  • The file input is hidden visually and triggered programmatically by clicking the drop zone label.
  • The drop zone is keyboard-accessible — users can tab to it and press Enter or Space to open the file picker.
  • Error messages are displayed inline with alert icons for visual clarity.
  • When disabled, pointer-events: none prevents accidental interaction.
  • File status (uploading, completed, error) is communicated with both icons and text labels for users who cannot perceive colour alone.