Alerts

Alerts Component

Contributed by Chaoyang Li

Alerts component displays a callout for user attention.

Basic Component

Appearance

Alerts user by message. You can define the color and the theme of Alert yourself.

Code Usage

Animation

Alert component has different display modes when triggered.

Code Usage

Variants

With description

In some cases, Alert requires description. Description includes a message with more detailed information.

Code Usage

With list

The detailed information of alert can also be shown as a list.

Code Usage

With accent border

Code Usage

With link

You can add link in the alert.

Code Usage

With dismiss button

Default alert component will be close automatically. You can also add a dismiss button, so that user can close by clicking button.

Code Usage

With actions

An actionable alert can help users to understand the alert and have further actions.

Code Usage

Usability

Make alert banners actionable

Whenever possible, add action button if there's a way for a user to quickly address the issue associated with an alert.

Consider including a close button

The close button is optional, depending on context. Consider adding one to let a user easily dismiss the alert.

Use the color appropriately

Don’t use yellow or orange colors for errors because the contrast is not accessible. If you need to show a “notice” message or other non-critical communication, use the blue (informative) semantic color options. Reserve the red (negative) option only for errors that directly interrupt or block a user’s experience — not for nice-to-know information.

Place alert banners at the top

Alert banners should appear at the top of a page.

Don't stack alert banners

Don't show multiple alert banners at the same time. If a new alert appears with a higher priority message, it should replace an existing alert of lesser importance until the higher priority one has been addressed.

Overlay content

Overlay an alert when it's expected to fade in and out without impacting the content underneath it, and when it's not hiding any important actions or information by being there. An alert should only overlay content if it is dismissible.

Accessibility

Add Sound when alert are triggered

For some visually impaired people, adding a corresponding prompt sound to ensure that the visually impaired users are aware the alerts and improve their fluency in using the webpage.

Code Usage

Vision

VersionEditorAuthorDateDescription
v1.0Chaoyang LiChaoyang Li28/09/2023Initial version