Skip to Main Content
Mosaic Logo
Mosaic Logo
  • Home
  • Browse components
  • Use in projects
    • Colors
    • Icons
    • Grid
    • Links
    • Typography
    • Spacing Utilities
    • SVG
    • Accordions
    • Alerts
    • Badges
    • Buttons
    • Copy to clipboard
    • Cards
    • Featured Container
    • Filter Bar
    • Lists
    • Loading Spinners
    • Modals
    • Pagination
    • Progress Bars
    • Progress Indicator
    • Site Banner
    • Tables
    • Tabs
    • Toast
    • Toggle Switches
    • Well
    • Wizard
    • Events
    • File Browser
    • File Upload
    • Footer
    • Header
    • Hero
    • Post Item
    • Profile
    • Sidebar Navigation
    • Splash
    • Stack
    • Form Instructions
    • Form Layout
    • Form Validation
    • Form Output
    • Checkboxes
    • Labels
    • Radio Buttons
    • Search Input
    • Select
    • Text Inputs

File Upload

Definition

The Upload Component is a user interface element that allows users to upload multiple files to a server by dragging and dropping them onto a designated area on the page. The component consists of a drop zone element and a separate element to display the upload progress.

Since drag and drop isn't accessible to screen reader users we also provide a link for users to browse in their file explorer.

Behavior

Files that fail to upload should move to the top of the upload list so that they are prominent.

Files that are in progress display a progress bar.

Files that are processing are finished uploading and display details of file processing steps with an animated ellipsis.

Files that have been uploaded and processed will appear in a separate file browser component below the file upload module.

File Drag Indication

When a file is dragged over the drop zone, the component provides visual feedback to indicate that the drop zone is a valid target for the file. After the file is dropped, the component will initiate the upload and display the upload progress in real-time.

When a file is dragged over the .file-drag region add the class .drag-over so that the region changes color.

Example of drag-over state

Drag files here or click to download



    <div class="file">
      <div class="file-drag drag-over">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
          <path
            class="grey-500"
            d="M288 109.3V352c0 17.7-14.3 32-32 32s-32-14.3-32-32V109.3l-73.4 73.4c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l128-128c12.5-12.5 32.8-12.5 45.3 0l128 128c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L288 109.3zM64 352H192c0 35.3 28.7 64 64 64s64-28.7 64-64H448c35.3 0 64 28.7 64 64v32c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V416c0-35.3 28.7-64 64-64zM432 456a24 24 0 1 0 0-48 24 24 0 1 0 0 48z">
          </path>
        </svg>
        <p>Drag file here or <a href="#">Browse files</a></p>
      </div>
      ...
    </div>
    

Messaging

Alert Banner - Warning

The alert banner should remain on the screen only when an upload is in progress. When files are finished uploading it should be removed from the DOM.

2 files failed to upload. If the error persists, please email [email protected] with a screenshot and description of the issue.


<div class="alert alert-warning d-flex">
  <div class="align-self-start"><i class="fa-solid fa-circle-info"></i></div>
  <div class="align-self-center">
    <span>Don't leave the page while upload is in progress</span>
  </div>
</div>

Alert Banner - Error
Don't leave the page while upload is in progress

<div class="alert alert-danger d-flex">
  <div class="align-self-start">
    <i class="fa-solid fa-triangle-exclamation"></i>
  </div>
  <div class="align-self-center">
    <p>
      2 files failed to upload. If the error persists, please email
      <a href="#">[email protected]</a> with a screenshot and description
      of the issue.
    </p>
  </div>
</div>

File icons for upload component

File error
File extension: .pdf
File extension: .xls
File extension: .mpeg
File extension: .xls

Accessibility Considerations

Upload Summary and ARIA: role="region"

File Upload has been designed to provide a streamlined and accessible user experience. Instead of having multiple aria-live attributes on each progress bar, we have a single text container that displays a summary of the current upload progress. This allows screen reader users to get an overview of all the file uploads at once, without being bombarded with a multitude of alert messages.

Aria role="region" is used to define a live region that provides information about the status of a file upload. This role is essential for ensuring that screen reader users receive timely updates about the progress and outcome of the upload.

Usage
  1. The role attribute with a value of region on the HTML element represents the status region. This indicates that the element serves as a container for live updates.
  2. The aria-live attribute with a value of polite ensures that the updates are announced to the user after the current speech is finished, without interrupting or forcing immediate attention.
  3. The aria-atomic attribute set to true indicates that the entire contents of the region should be treated as a single unit and announced together.
Benefits
  • Real-time updates: Screen reader users receive immediate feedback on the progress and status of the file upload without requiring manual refreshing or interaction.
  • Timely notifications: The live region ensures that updates are announced to the user in a non-intrusive manner, allowing them to stay informed about the upload status while continuing with their current tasks.

Upload Summary

The upload summary should remain visible after uploading is complete.

Some screenreader text is added using bootstrap's visually-hidden class that says "File Upload Status:" to provide some context to the summary information.

File Upload Status:3 files complete, 2 uploading, 1 processing, 2 failed, 2 in queue

<div class="file-summary">
  <span
    class="text-center"
    role="region status"
    aria-live="polite"
    aria-atomic="true"
    ><span class="visually-hidden">File Upload Status:</span>3 files complete, 2
    uploading, 1 processing, 2 failed, 2 in queue
  </span>
</div>

Example

Select your files *

Maximum file size is 1GB. Acceptable file formats are .pdf and .docx

Drag files here or click to download

2 files failed to upload. If the error persists, please email [email protected] with a screenshot and description of the issue.

Don't leave the page while upload is in progress
3/5 files uploaded
File Upload Status:3 files complete, 2 uploading, 1 processing, 2 failed, 2 in queue
  • File error
    pear-review.pdf Error - Wrong file format.

  • File error
    apple-review.pdf Error - A virus was found on your file.

  • File processing
    neverGonnaGiveYouUp.mpeg
    45%

  • File processing
    mango-review-dry-nasty.excel
    75%

  • File processing
    guava-review-juicy-great.excel Processing: virus scan . . .

  • File processing
    coffee-jitters.excel Waiting to upload . . .

  • File extension: .xls
    banana banana banana.zip Waiting to upload . . .

Uploaded Files

Successfully uploaded files will appear in the table below.

 
File Browser - View and search files. Column headers with buttons are sortable.
File Name
Size
File Type
Actions
Budget Forecast.pdf
2.3MBPDF
2024 highest selling baseball cards.mov
2GBvideo
Picture of the front of your house
2.3MBimage

Confirming changes

When a user deletes or cancels a file a modal message should appear for the user to confirm their choice.

Modal confirmation message

Delete File

This will permanently delete "file-name.pdf." Do you want to delete?


Do's

  • Do include supported file formats and file size restrictions as form instructions or helper text.
  • Do use a specific and descriptive form label that accurately describes what the user is trying to upload.

Dont's

  • Don't use file upload oustide of a <fieldset> or <form> element.

References

  • Live Regions
  • facebook

  • Instagram

  • Twitter

  • LinkedIn

  • YouTube

  • Accessibility
  • Privacy Policy
  • Contact Us
Sign up for our newsletter
ICPSR

© 2025 The Regents of the University of Michigan. ICPSR is part of the Institute for Social Research at the University of Michigan.