-
Notifications
You must be signed in to change notification settings - Fork 17
Add upload usage guide #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kathrinschalber
wants to merge
7
commits into
main
Choose a base branch
from
upload-usage-guide
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1b3972a
Create ideation.md
kathrinschalber 681a393
first draft
kathrinschalber a02a501
Improve Upload docs and add Figma images
kathrinschalber d7180e0
Delete ideation.md
kathrinschalber ffeabaa
Update sidebars.ts
kathrinschalber a2a3b8b
apply feedback from coderabbit review
kathrinschalber 77c3f00
Merge branch 'main' into upload-usage-guide
kathrinschalber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| --- | ||
| doc-type: 'tab-item' | ||
| description: 'Usage guide for upload component.' | ||
| --- | ||
|
|
||
| # Upload - Usage | ||
|
|
||
| Uploads help users add files to a form or workflow from their device. Use them when users need to provide one or more files as part of a task, and make the file rules and upload status visible near the control. | ||
|
|
||
|  | ||
|
|
||
| 1. Drag-and-drop target area | ||
| 2. Input button | ||
| 3. Instruction text | ||
|
|
||
| ## Variants | ||
|
|
||
| - **Single file:** Use when the task needs one file only, e.g. a profile image, configuration file or certificate. After a successful upload, replace the drop zone with the uploaded item or provide a clear replace action. | ||
| - **Multiple files:** Use when users need to submit a set of files. Show the uploaded files in a list so users can review each fileβs name, size, status and available actions. | ||
|
|
||
| ## Options | ||
|
|
||
| - **Accepted file types:** Describe the allowed file types with familiar names and extensions, e.g. βPDF or PNGβ. Use the accepted types to prevent unsupported files from being selected. | ||
| - **Directory upload:** Allow folder selection when the task involves a complete set of files and the target browser supports it. Use multiple-file upload when users need to choose individual files. | ||
| - **Label:** Use short, specific labels for the default, checking, success, failed and disabled states. Keep the action clear, e.g. βSelect fileβ or βSelect filesβ. | ||
| - **Multiline:** Use multiline labels when the available width is limited or the instruction needs more context. Keep the label concise so the upload area remains easy to scan. | ||
|
|
||
| :::tip | ||
|
|
||
| Make the upload form-ready by using [custom fields](../custom-field/), e.g. to add a label and helper text and to integrate with [form validation](../forms-validation). | ||
|
|
||
| ::: | ||
|
|
||
| ## Behavior in context | ||
|
|
||
| - **Interaction:** Users select files by clicking the input button or dragging files into the target area. Keep both methods available when drag-and-drop is useful, because it isnβt available or convenient in every environment. | ||
| - **Overflow:** Let labels, helper text and validation messages wrap onto multiple lines. Keep file names readable and provide an action such as remove or replace instead of hiding important text with a tooltip. | ||
| - **Placement:** Place uploads near the related form fields or task action. Use [form fields](../forms-field) when the upload needs a label, helper text or validation message. | ||
| - **Responsiveness:** Let the upload area fill the available form width and use the multiline option when its label becomes difficult to scan at narrow widths. Keep the control height aligned with nearby fields when it appears in a form. | ||
| - **Feedback:** Show checking progress and file-level errors next to the affected file or upload area. Use a [toast](../toast) only for system-level feedback that doesnβt need to stay connected to a specific file. | ||
|
|
||
| ## States | ||
|
|
||
| Uploads have seven documented states: Default, drag over, checking, success, fail and disabled. The checking states keep users informed while the file is being inspected, while success and fail communicate the result of that check. Multi-file implementations can also show queued or completed statuses on individual file rows. | ||
|
kathrinschalber marked this conversation as resolved.
Outdated
|
||
|
|
||
|  | ||
|
|
||
|
|
||
| ## Dos and Donβts | ||
|
|
||
| <div className="dos-and-donts"> | ||
| <div className="dos"> | ||
| <ul aria-label="Recommended practices"> | ||
| <li>Do state the allowed file types, maximum size and whether users can select multiple files</li> | ||
| <li>Do keep upload feedback close to the upload area or the affected file</li> | ||
| <li>Do provide a replace or remove action after users select a file</li> | ||
| <li>Do keep the upload area aligned with adjacent form controls</li> | ||
| </ul> | ||
| </div> | ||
| <div className="donts"> | ||
| <ul aria-label="Practices to avoid"> | ||
| <li>Donβt hide file restrictions in a tooltip when they affect whether users can complete the task</li> | ||
| <li>Donβt use an upload when users only need to choose an existing item, use a <a href="../select/">select</a> instead</li> | ||
|
kathrinschalber marked this conversation as resolved.
Outdated
|
||
| <li>Donβt rely on drag-and-drop as the only way to select files</li> | ||
| <li>Donβt use a toast as the only explanation for a file-level validation error</li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
|
|
||
| ## Related | ||
|
|
||
| - [Custom field](../custom-field) | ||
| - [Form field](../forms-field) | ||
| - [Validation](../forms-validation) | ||
| - [Select](../select) | ||
| - [UX writing](../../guidelines/language/writing-style-guide-getting-started.md) | ||
| - [Accessibility](../../guidelines/accessibility) | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.