File upload
Allows users to upload and preview files. It features a title, upload guidelines, an upload button, and a list displaying the uploaded items, with built-in error handling for file uploads.
File preview
The file preview is used to display details about a file or media item once it has been uploaded, including the file name, type, and an option to remove the file.
- Thumbnail/Icon: Displays a thumbnail for images or videos. An icon is shown for other file types such as PDFs, DOCX, PPTX, XLSX, etc.
- File Name: The name of the uploaded file, which is truncated if too long.
- File Extension: The file type displayed at the end of the file name (e.g., .pdf, .jpeg, .docx).
- Trailing Icon: A close icon that allows the user to remove the uploaded file.
State
-
Default: The normal state when a file has been uploaded and is displayed.
-
Hover: When the user hovers over the item, showing possible actions like removing the file. 2a. Hover on Remove icon: When the user hovers on remove button. Optional adding tooltip to guide user what the button will do.
-
Disabled: The item is not interactive, typically when the file cannot be removed or edited.
-
Loading: When the file is in the process of being uploaded.
Loading
When a file is being uploaded, the loading state is initiated until the file is fully uploaded.
- Spinner: Displays a loading spinner in place of the file thumbnail while the upload is in progress
- File Name: Displays "Uploading..." instead of the actual file name until the upload is complete.
File upload
Usually displayed in a form that required to upload single or multiple files.
- Title: Indicates the purpose of the file upload section, such as "Supporting Documents".
- File Format: Tells users what file formats are supported.
- Max File Size: Specifies the maximum file size allowed.
- Upload Button: A button that allows users to upload files.
- Hint/Error Message: Displays messages to inform users of issues like file size limits or unsupported formats.
- Uploaded File List: Shows the Uploaded Item component, listing the files that have been uploaded by the user.
- Optional Previously Uploaded File List: Displays previously uploaded files, if required, allowing users to compare newly uploaded files with older ones. This is rarely used but can be helpful in specific cases.
State
- Default: The initial state, allowing users to upload files.
- Disabled: The file upload section is disabled, preventing user interaction.
- Loading: Shows a loading state while files are being uploaded.
- Uploaded: Indicates that files have been successfully uploaded and are displayed in the uploaded file list.
- Error: Displays an error message when there is an issue with file uploads (e.g., file size too large or unsupported format).
Usage example
Location: The File Upload Group is typically used in forms or modals where users are required to submit documents or files as part of a process (e.g., applications, support tickets). It helps streamline the document submission workflow.
Width: The width is usually set to full width to fit the container of the form or modal, ensuring it adapts to the available space.