Alert
On this page
General guidelines
In general, use an alert to communicate essential information to a user in a prominent way.
When to use an inline alert
Use an inline alert to communicate a short message about a specific user action within a component or layout. An inline alert appears in a content area and disappears when a user closes it or navigates away from the page. For example, use an inline alert to inform a user their form was submitted with errors.
When to use a toast alert
Use a toast alert to communicate a time-based update, confirmation, or other short message to a user without blocking their workflow. A toast alert overlays content in the top right corner of a page and disappears when a user closes it or when it times out. For example, use a toast alert to inform a user their information was submitted successfully.
Status levels
The status levels for alerts are Neutral, Info, Success, Warning, Caution, and Error. Each level communicates a specific message or severity.
Helpful tip
Go to the Color page to learn more about using status levels.
Dismissal
Depending on the message, an inline alert can be dismissible or not dismissible. The close button should not be included if it is critical that a user read or interact with the alert. A toast alert is always dismissible.
Writing content
Both alert variants have limited space. Therefore content should be short and concise. A user should be able to quickly scan the content and know what steps to take next.
Element | Character count | How to write |
---|---|---|
Title text | 60 |
|
Body text | 150 |
|
Action text | 20 per button |
|
Actions
Actions enable a user to perform a specific action in relation to the alert message. Both alert variants may include actions, but no more than two. Actions require using specific elements, however including actions is optional.
- Primary action - use the Secondary button element
- Secondary action - use the Link button element
Layout
Inline
An inline alert appears at the top of a content area or close to an item needing attention. The width varies based on content and layout. They can expand to fill a container or related content area.
Toast
A toast alert slides in from the top right corner of a page and then disappears when a user closes it or when it times out. A toast alert can be set as persistent or temporary depending on the message.
- Persistent - does not disappear unless dismissed by a user
- Temporary - disappears after eight seconds unless dismissed by a user first
Behavior
Stacking
When multiple toast alerts appear one after the other, they stack. The most recent alert appears at the top and pushes the rest down. When an alert disappears, the rest will fill the empty space.
Responsive design
Large screens
On large screens, inline alert height is determined by the amount of content included. Inline alert width is determined by the width of its container or related content area. Toast alert height is also determined by content, but its max width is 480px.
Small screens
On small screens, both alert variants will span one column, and toast alerts will continue to stack.
Best practices
Mixing use cases
Use the correct alert variants for the correct use cases.
Do not use an inline alert for toast alert use cases and vice versa.
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.