File Upload
Allows users to upload files of various sizes and formats
Example
Anatomy
- Icon (situational): Serves to give a visual cue to the upload button.
- Button: Button component is used.
- Uploaded content: To show users what has been uploaded.
- Validation and remove: Serves to inform users if a file has been sucessfully uploaded and allow them to remove if needed.
Spacing
Within the file upload
Ensure that there is a min of 16px vertical spacing between the button,
hint text and uploaded items and a min of 8px between uploaded items.
Usage guidelines
Best practices:
- Show the progress of uploading.
- Error messages about file uploads must be exposed to assistive technology.
- The delete button needs to have the uploaded file name associated with it programmatically, so the user understands which file will be removed.
File upload should be used when:
- You require users to upload mandatory documents. E.g proof of signature.
File upload should not be used when:
- Documents are optional and a text input field or text area may be more suitable.
- When you require users to upload large files.
Usability guidelines
State the file specifications clearly
Stating the file specifications clearly will prevent users from uploading invalid formats, exceeding file size and encountering errors.
Have clear labelling and use hint text
Ensure you label the file upload clearly as well as hint text when necessary so users know what exactly they have to upload.
Behaviour
A file that is being uploaded should have three distinct states—loading, success, and uploaded.
Accessibility guidelines
Keyboard accessibility
- Tab or Shift-Tab to navigate between file upload button and the remove file button of the uploaded file.
- Enter or Space on the upload button to open file upload dialog.
- Enter or Space on the remove file button to remove the file.
Focus indicator
- Use a clear and distinct focus indicator to help users identify when the file upload input is focused.
- Ensure the focus indicator is highly visible against different backgrounds and contrasts well with the surrounding elements.
- Offer visual and auditory feedback when the file is successfully uploaded or when there is an error.
Last updated 02 October 2024