Standard alerts are part of the content area. These alerts are for notifying users that a particular component or area of the screen needs attention
<div class="joy-alert">
<div class="joy-alert__content">
Hello! I'm a default alert.
</div>
</div>
<div class="joy-alert joy-alert--small">
<div class="joy-alert__content">
Hello! I'm a small default alert.
</div>
</div>
Alerts headings should be used to summarize longer alert messages when necessary. They should just be placed inside a <p> tag instead of an <h1-6> tag.
Alert Headings
Alerts headings should be used to summarize longer alert messages when necessary. They should just be placed inside a<p> tag instead of an <h1-6> tag.
<div class="joy-alert">
<div class="joy-alert__content">
<p class="joy-alert__heading">
Alert Headings
</p>
Alerts headings should be used to summarize longer alert messages when necessary. They should just be placed inside a `<p>` tag instead of an `<h1-6>` tag.
</div>
</div>
A close button (X, DISMISS, etc) serves as a method for users to acknowledge the alert. It also allows users to declutter the view. Omit the close button if the alert should be persistent.
Apply the class .joy-alert--is-hidden to the .joy-alert element to hide an alert.
<div class="joy-alert">
<div class="joy-alert__content">
I'm an alert with an action. In this case, the action is an SVG icon.
</div>
<div class="joy-alert__action" data-dismiss="alert-demo">
<svg class="svg-icon svg-icon--close" xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 100 100">
<path class="svg-icon__path" d="M98.17 89.33L58.84 50l39.33-39.33c2.44-2.44 2.44-6.4 0-8.84-2.44-2.44-6.4-2.44-8.84 0L50 41.16 10.67 1.83C8.23-.6 4.27-.6 1.83 1.83c-2.44 2.44-2.44 6.4 0 8.84L41.16 50 1.83 89.33c-2.44 2.44-2.44 6.4 0 8.84 2.44 2.44 6.4 2.44 8.84 0L50 58.84l39.33 39.33c2.44 2.44 6.4 2.44 8.84 0 2.44-2.44 2.44-6.4 0-8.84z"/>
</svg>
</div>
</div>
<div class="joy-alert">
<div class="joy-alert__content">
The action can also be text.
</div>
<div class="joy-alert__action" data-dismiss="alert-demo">
UNDO
</div>
</div>
<div class="joy-alert">
<div class="joy-alert__content">
The action text can be anything you like, but try to keep it short and contextual to the action the user needs to perform.
</div>
<div class="joy-alert__action" data-dismiss="alert-demo">
Dismiss
</div>
</div>
There are 4 types of alerts, each of which denotes a different level of severity:
Alerts have their own color palette of red, yellow, green, and blue. They are not styled with base colors to avoid competition with call-to-action buttons.
<div class="joy-alert joy-alert--danger">
<div class="joy-alert__content">
<h1 class="joy-alert__heading">
Danger Alert
</h1>
There is a problem that need to be fixed immediately.
</div>
<div class="joy-alert__action" data-dismiss="alert-demo">
<svg class="svg-icon svg-icon--close" xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 100 100">
<path class="svg-icon__path" d="M98.17 89.33L58.84 50l39.33-39.33c2.44-2.44 2.44-6.4 0-8.84-2.44-2.44-6.4-2.44-8.84 0L50 41.16 10.67 1.83C8.23-.6 4.27-.6 1.83 1.83c-2.44 2.44-2.44 6.4 0 8.84L41.16 50 1.83 89.33c-2.44 2.44-2.44 6.4 0 8.84 2.44 2.44 6.4 2.44 8.84 0L50 58.84l39.33 39.33c2.44 2.44 6.4 2.44 8.84 0 2.44-2.44 2.44-6.4 0-8.84z"/>
</svg>
</div>
</div>
<div class="joy-alert joy-alert--warning">
<div class="joy-alert__content">
<h1 class="joy-alert__heading">
Warning Alert
</h1>
Watch out, you may want to think twice about doing this.
</div>
<div class="joy-alert__action" data-dismiss="alert-demo">
<svg class="svg-icon svg-icon--close" xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 100 100">
<path class="svg-icon__path" d="M98.17 89.33L58.84 50l39.33-39.33c2.44-2.44 2.44-6.4 0-8.84-2.44-2.44-6.4-2.44-8.84 0L50 41.16 10.67 1.83C8.23-.6 4.27-.6 1.83 1.83c-2.44 2.44-2.44 6.4 0 8.84L41.16 50 1.83 89.33c-2.44 2.44-2.44 6.4 0 8.84 2.44 2.44 6.4 2.44 8.84 0L50 58.84l39.33 39.33c2.44 2.44 6.4 2.44 8.84 0 2.44-2.44 2.44-6.4 0-8.84z"/>
</svg>
</div>
</div>
<div class="joy-alert">
<div class="joy-alert__content">
<h1 class="joy-alert__heading">
Default Alert
</h1>
Hey, just so you know, here's some information that may be helpful.
</div>
<div class="joy-alert__action" data-dismiss="alert-demo">
<svg class="svg-icon svg-icon--close" xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 100 100">
<path class="svg-icon__path" d="M98.17 89.33L58.84 50l39.33-39.33c2.44-2.44 2.44-6.4 0-8.84-2.44-2.44-6.4-2.44-8.84 0L50 41.16 10.67 1.83C8.23-.6 4.27-.6 1.83 1.83c-2.44 2.44-2.44 6.4 0 8.84L41.16 50 1.83 89.33c-2.44 2.44-2.44 6.4 0 8.84 2.44 2.44 6.4 2.44 8.84 0L50 58.84l39.33 39.33c2.44 2.44 6.4 2.44 8.84 0 2.44-2.44 2.44-6.4 0-8.84z"/>
</svg>
</div>
</div>
<div class="joy-alert joy-alert--success">
<div class="joy-alert__content">
<h1 class="joy-alert__heading">
Success Alert
</h1>
Great job. You did a very good thing.
</div>
<div class="joy-alert__action" data-dismiss="alert-demo">
<svg class="svg-icon svg-icon--close" xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 100 100">
<path class="svg-icon__path" d="M98.17 89.33L58.84 50l39.33-39.33c2.44-2.44 2.44-6.4 0-8.84-2.44-2.44-6.4-2.44-8.84 0L50 41.16 10.67 1.83C8.23-.6 4.27-.6 1.83 1.83c-2.44 2.44-2.44 6.4 0 8.84L41.16 50 1.83 89.33c-2.44 2.44-2.44 6.4 0 8.84 2.44 2.44 6.4 2.44 8.84 0L50 58.84l39.33 39.33c2.44 2.44 6.4 2.44 8.84 0 2.44-2.44 2.44-6.4 0-8.84z"/>
</svg>
</div>
</div>
An app-level alert appears at the top of the screen, above the application navbar. This alert is reserved for a single, system-level message.
App-level alerts have three severity levels:
| Type | Example |
|---|---|
| Danger | This service will be unavailable all day tomorrow. |
| Default | Your password will expire in 4 days. |
| Offline | No internet connection detected. Data may not be saved. |
<div class="joy-alert joy-alert--app-level">
<div class="joy-alert__content">
Update available. Please refresh your browser.
<button class="joy-button joy-button--white joy-button--small joy-m-left--medium">
REFRESH
</button>
</div>
<div class="joy-alert__action" data-dismiss="alert-demo">
<svg class="svg-icon svg-icon--close" xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 100 100">
<path class="svg-icon__path" d="M98.17 89.33L58.84 50l39.33-39.33c2.44-2.44 2.44-6.4 0-8.84-2.44-2.44-6.4-2.44-8.84 0L50 41.16 10.67 1.83C8.23-.6 4.27-.6 1.83 1.83c-2.44 2.44-2.44 6.4 0 8.84L41.16 50 1.83 89.33c-2.44 2.44-2.44 6.4 0 8.84 2.44 2.44 6.4 2.44 8.84 0L50 58.84l39.33 39.33c2.44 2.44 6.4 2.44 8.84 0 2.44-2.44 2.44-6.4 0-8.84z"/>
</svg>
</div>
</div>
<div class="joy-alert joy-alert--app-level joy-alert--danger">
<div class="joy-alert__content">
Application will be unavailable from 9am to 5pm PST.
</div>
<div class="joy-alert__action" data-dismiss="alert-demo">
<svg class="svg-icon svg-icon--close" xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 100 100">
<path class="svg-icon__path" d="M98.17 89.33L58.84 50l39.33-39.33c2.44-2.44 2.44-6.4 0-8.84-2.44-2.44-6.4-2.44-8.84 0L50 41.16 10.67 1.83C8.23-.6 4.27-.6 1.83 1.83c-2.44 2.44-2.44 6.4 0 8.84L41.16 50 1.83 89.33c-2.44 2.44-2.44 6.4 0 8.84 2.44 2.44 6.4 2.44 8.84 0L50 58.84l39.33 39.33c2.44 2.44 6.4 2.44 8.84 0 2.44-2.44 2.44-6.4 0-8.84z"/>
</svg>
</div>
</div>
<div class="joy-alert joy-alert--app-level joy-alert--offline">
<div class="joy-alert__content">
No internet connection detected.
</div>
<div class="joy-alert__action" data-dismiss="alert-demo">
<svg class="svg-icon svg-icon--close" xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 100 100">
<path class="svg-icon__path" d="M98.17 89.33L58.84 50l39.33-39.33c2.44-2.44 2.44-6.4 0-8.84-2.44-2.44-6.4-2.44-8.84 0L50 41.16 10.67 1.83C8.23-.6 4.27-.6 1.83 1.83c-2.44 2.44-2.44 6.4 0 8.84L41.16 50 1.83 89.33c-2.44 2.44-2.44 6.4 0 8.84 2.44 2.44 6.4 2.44 8.84 0L50 58.84l39.33 39.33c2.44 2.44 6.4 2.44 8.84 0 2.44-2.44 2.44-6.4 0-8.84z"/>
</svg>
</div>
</div>
<div class="joy-navbar">
<div class="joy-navbar__primary">
<a href="#" class="joy-brand">
<svg class="joy-brand__svg" viewBox="0 0 79 39" xmlns="http://www.w3.org/2000/svg">
<path class="joy-brand__svg--path" d="M63 2.1h.7l.6 1.6.6-1.6h.7v2.3H65V2.6l-.6 1.8H64l-.6-1.8v1.8H63V2.1zm-2.4 0h2v.4h-.7v1.9h-.5V2.5h-.7v-.4h-.1zM17.5.7h31l-4.7 7.5h-31L17.5.7zm51.8 37.8L64.6 31H50.9l4.7-7.5h4.3L54.7 15 40 38.5H.8l9.4-15.1H3.3L8 15.9h30.3l-4.7 7.5H19.2l-4.7 7.5h21.4L54.8.7l23.6 37.7h-9.1v.1z" fill-rule="evenodd"/>
</svg>
<span class="joy-brand__separator">
</span>
<span class="joy-brand__text">
Navbar
</span>
</a>
</div>
<ul class="joy-navbar__group">
<li class="joy-navbar__item">
<a href="#" class="joy-navbar__link ">Link</a>
</li>
<li class="joy-navbar__item">
<a href="#" class="joy-navbar__link joy-active">Active Link</a>
</li>
<li class="joy-navbar__item">
<a href="#" class="joy-navbar__link">Link</a>
</li>
</ul>
</div>
Standard alerts are part of the content area. These alerts are for notifying users that a particular component or area of the screen needs attention. Standard alerts have four levels, denoted by color. From most to least severe, they are:
Other choices for displaying messages are input field validations and modals . However, these components require users to take action before proceeding.
Alert positioning should be contextual to the component or area to which it applies. For example, if the alert applies to the entire content area, place it at the top and span the width of that area.
A close button (X, DISMISS, etc) serves as a method for users to acknowledge the alert. It also allows users to declutter the view. Omit the close button if the alert should be persistent.
Keep the message text short and concise. If combining multiple messages in a single alert, make sure that the messages are of the same type. Avoid mixing danger and warning messages.
Alerts have their own color palette of red, yellow, green, and blue. They are not styled with base colors to avoid competition with call-to-action buttons.
Alerts can be stacked if you need to show multiple alerts at once. When showing multiple alerts, stack from most severe to least severe:
Stack up to three alerts. For more than three, consider an alternate pattern, such as displaying the information on another page.