File Uploader

Design System - File Uploader component

The File Uploader component allows users to easily upload documents and images through drag-and-drop, browse, or click actions. Built with accessibility and clarity in mind, this component ensures seamless interaction, feedback on file status, and visual clarity. It accommodates various upload needs like single, multiple, or preview-based, with consistent interaction feedback.

// Sample code

  <CheckBox
    label="Label"
    onChange={(e)=>{console.log(e.target.checked}}
  />

Anatomy


Variants


Uploader Field

A compact file upload input paired with an action button. Best suited for single file uploads in form layouts.

Uploader Widget

A more interactive drag-and-drop style uploader. Useful when multiple files need to be uploaded or where visual cues are important.

Image Upload

A visual first variant designed to upload and preview images. Users can click to add, preview thumbnails, or remove images directly.


Interaction States

Hover State for Multiple Image Load

When the user hovers over the field or an item, it highlights to indicate interactivity and help the user discover selectable areas.

Mouse Down State for Multiple Image Load

When the user performs a mouse-down action on the Image Upload area, a contextual menu appears offering multiple options for uploading. This menu typically includes:
 Camera – Opens the device’s camera to capture and upload a new image instantly. My Files – Opens the file explorer or gallery to choose existing images from the device.
 This interaction provides flexibility and enhances the upload experience, especially on mobile devices or when real-time photo capture is required.

Properties

Single Upload

Allows only one file to be uploaded at a time. Automatically replaces existing files.

Multiple Upload

Enables uploading of several files. Each file is shown with a re-upload and download option.

Error

Displays error messages per file or globally. Indicates upload failure, unsupported format, or size limit.

Label

Each uploader can have a custom label to define the upload purpose clearly.

Actions

Includes an option to upload using the “device camera” and “my files” options, only applicable for the image upload variant.

Property Configuration Table

Each design component offers a range of configurable options. These options are intentionally platform-agnostic, allowing implementations to adapt and tailor them to align with the specific requirements of the chosen framework.

Property
Value
Default

variant

text

multiple

text

onUpload

yes/no

no

validations

yes/no

no

removeTargetedFile

number

showHint

yes/no

showLabel

yes/no

no

accept

yes/no

no

additionalElements

yes/no

no

showErrorCard

number

no

iserror

yes/no

no

showDownloadButton

text

no

showReUploadButton

yes/no

no

customClass

yes/no

disabled

yes/no

style

yes/no

id

yes/no

extraStyles

yes/no

disabledButton

yes/no

textStyles

yes/no

buttonType

yes/no

showAsTags

yes/no

showAsPreview

yes/no

inline

yes/no

label

yes/no


Behaviours

Drag & Drop Support

Uploader Widget allows users to drag and drop files into the designated area.


Usage Guide


Allow to preview uploaded files

Provide a thumbnail or preview option for the uploaded images. This helps users verify that they uploaded the correct file before submitting it.

Avoid using generic error messages like "Upload failed" without explanation. Users need to know why their file wasn't accepted and what they should do next.

Changelog


Date
Number
Notes

Dec 15, 2024

v-0.0.2

This component is added to the website. This component is now individually versioned.

Design Checklist


All interactive states - Includes all interactive states that are applicable (hover, down, focus, keyboard focus, disabled).

Accessible use of colours - Colour is not used as the only visual means of conveying information (WCAG 2.1 1.4.1)

Accessible contrast for text - Text has a contrast ratio of at least 4.5:1 for small text and at least 3:1 for large text (WCAG 2.0 1.4.3).

Accessible contrast for UI components - Visual information required to identify components and states (except inactive components) has a contrast ratio of at least 3:1 (WCAG 2.1 1.4.11).

Keyboard interactions - Includes all interactive states that are applicable (hover, down, focus, keyboard focus, disabled).

Screen reader accessible - All content, including headings, labels, and descriptions, is meaningful, concise, contextual and accessible by screen readers.

Responsive for all breakpoints - Responsiveness for 3 breakpoints - Mobile, Tablet and Desktop

Usage guidelines - Includes a list of dos and don'ts that highlight best practices and common mistakes.

Writing guidelines - Content standards and usage guidelines for writing and formatting in-product content for the component.

Defined variants and properties - Includes relevant variants and properties (style, size, orientation, optional iconography, decorative elements, selection states, error states, etc.)

Defined behaviours - Guidelines for keyboard navigation and focus, layout management (including wrapping, truncation, and overflow), animations, and user interactions.

Design Kit - Access to the design file for the component in Figma, multiple options, states, colour themes, and platform scales.

Last updated

Was this helpful?