Toast
DESIGN IN PROGRESS IMPLEMENTATION PENDING
Toast is a pop-up style message that shows the user a brief, fleeting, dismissible message about a successful app process.
Contributors | @Gabriel Weinberg @Carla Duarte (Deactivated) @Adam Butterworth (Deactivated) |
---|---|
Slack channel | |
Paragon Jira ticket | https://openedx.atlassian.net/browse/PAR-170 https://openedx.atlassian.net/browse/PAR-289 |
Other Jira tickets | |
Design resources | https://www.figma.com/file/eGmDp94FlqEr4iSqy1Uc1K/Paragon-2021?node-id=7583%3A878 |
Technical docs |
Design
Variants
Property |
|
---|---|
withAction | False, True |
Best Practices
Example use cases: Saving changes in Studio, or shifting your due dates in the LMS.
Use only for success
Toast is only used for success because it cannot show the user where their error occurred. Errors should be handled at the source of the error, not with Toast
Optional button should only have an optional action
Toast disappears after 5 seconds. Any action that a user is required to take, (ie completing an assignment in order to pass the course), should not be used inside Toast.
One at a time
Give the user time to process. Don’t overload them with too much information
Specification
Background: Gray 700 | Font: Small Paragraph |
Icon Button(Dark Palette) | Icon: Close |
Optional Button, Secondary, Small, Dark | Corner radius: Radius 1 (4px) |
Positioning: Bottom, Left |
|
Z Index: Top-most layer | Elevation 5 Shadow |
Behaviors
Auto-dismiss | Toast automatically dismisses after 5 seconds by default. Disable timer:
Re-enable timer:
Auto-dismiss timer: 5 - 15 second range |
Animation when Toast is triggered | Fade-in duration: 500ms
|
Animation when Toast is dismissed or auto-dismissed | Fade-out duration: 200ms
|
Accessibility
Focus Management Expectations | The X should be a <button >with aria-label=”Close”. It’s best if the whole message container appear near the top of the DOM though it may physically be anywhere on screen. For urgent or modal messages, focus should be set on the container and then return to the previous origin when dismissed. |
Persistence | Important messages may auto-dismiss after 5s if they can be located again. If they can’t be located again, they should persist until dismisses. The persistence timer should stop if, on focus of any element in the snackbar, or on hover over the snackbar. The snackbar should not auto-dismiss while the user is attending to it. |
Animation Behaviors | Subtle (<2s) transition animations on open or close are OK. |
Semantics | A snackbar with no controls other than the close button should have role=”note”, role=”status”, or role=”alert” depending on the message urgency (are you intending to interrupt the user? Then it’s an alert.) A snackbar with controls other than the close button should have role=”dialog” or role=”alertdialog” depending on the message urgency. |
Notes
Notes from collaborator conversations or meetings regarding this component.
XX.XX.20XX