Skip to main content Skip to navigation Skip to search

Alerts are banners that are designed to draw the users attention to an important message. Icons and color indicate the type and urgency of the information contained within the message.

Usage

Use alerts to grab the user’s attention to provide critical information needed in context.

Types

There are two types of alerts, standard alerts and app level alerts.

Standard alerts

Standard alerts are used in the context of an application either in the content area itself or within components.

There are four different sub-types of standard alerts: error, warning, info, and success.

Ordered standard alerts by the urgency in which the user needs to pay attention to: error, warning, info, then success. In the case there are multiple of each sub-type all of them are shown before another sub-type is reached. For example, multiple errors are shown before the first warning is.

App Alerts

App-Level Alerts

App-level alerts are used in the global context of an application. They are placed at the very top of all content and navigation.

There are three different sub-types of app-level alerts info, warning, and error.

Sub-types

There are four different sub-types of standard alerts: error, warning, info, and success. Order standard alerts by the urgency in which the user needs to pay attention to: error, warning, info, then success. In the case there are multiple of each sub-type, all of them are shown before another sub-type is reached. For example, multiple errors are shown before the first warning is.

Error Alert

Error

Reserved for errors, malfunctions, as well as critical issues like license expiration.

Warning Alert

Warning

Reserved for warnings: a message that needs the user attention and acknowledgment but might not cause errors.

Info Alerts

Info

Reserved for errors, malfunctions, as well as critical issues like license expiration.

Success Alert

Success

Reserved to provide to a static persistent success message.

Anatomy

A standard alert consist of an icon, a message, and optional actions in a container. -Left align the icon and message. Right aligned the actions.

Size

There are two sizes of standard alerts: default and compact. Use the compact alert only in places where vertical space is scarce and information density is needed. Cards provide a good example here.

Success Alert

Placement

Standard alerts are used in the context of an application either in the content area itself or within components.

In Modals

Alert in modal

Alerts could appear within modals. It is recommended that no more than one alert appear within a modal. Their function should not be to validate, validation should be done inline and closer to the error itself.

In Cards

It is recommended to use concise language as you share an alert within a card. It is also recommended to use a compact-size alert. The focus of the alert should be on its content not on the alert appearing in it.

It is also recommended to have an alert at the very top of a card, on top of its title. An alert is meant to attract the attention of the user.

Using more than one alert within a card distracts the user and dilutes the importance of the alerts displayed. There are three sub-types of app-level alerts: error, warning, and info.

Alert in card

App-Level Alerts

App-level alerts are used in the global context of an application. They are placed at the very top of all content and navigation.

Sub-types

There are three different sub-types of app-level alerts info, warning, and error. App-level alerts follow the same urgency order as standard alerts: error, warning, and info.

Why no success app-level alert? App-level alerts are global in nature. Reporting a success of an operation should either be communicated within context or as a notification message.

Anatomy

An app-level alert consist of an icon, a message, and optional actions in a container. - All elements are centered-aligned. -Add anatomy for inline alerts - Need to add pagination

Placement

App-level alerts are placed at the very top of the global context. They should not be placed in any other configuration. Their purpose is to provide global alerts available and relating to the full context of the overall application.

App Level Warning Alert

Content

Depending on the sub-type of a standard alert, make sure to communicate a clear, concise, and actionable message.

Code & Examples

Several classes and elements are required to implement the Clarity alert layout. A table of these classes and elements with a brief description of each follows:

.alert This class is a wrapper around .alert-items and the .close button. Place the .close button before the alert items.
.alert-items This class is a wrapper around one or more .alert-items elements.
.alert-item This class is a wrapper around .alert-text, .alert-icon-wrapper, and .alert-actions.
.alert-icon-wrapper .alert-icon-wrapper contains a clr-icon with the classname .alert-icon applied to it. The icons used for the different alert types of success, danger, warning, and info are, respectively: check-circle, exclamation-circle, exclamation-triangle, and info-circle.
.alert-actions .alert-actions can consist of dropdowns or links. Each action should extend the .alert-action class.

Types

Clarity has error, warning, information, and success alerts denoted by the following classes:

  • .alert-danger
  • .alert-warning
  • .alert-info
  • .alert-success

Placement

Alerts in the Content Area

Header
This alert is at the top of the page.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

This alert is in the middle of the page.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Alerts in Cards

Project B Owner: Jane Doe

...

Alerts in Modals

Size

Use the .alert-sm class with .alert for an alert 24 pixels in height. The default is 36 pixels.

App-Level Alerts

.alert-app-level

This class must be applied with .alert to render an app-level alert.

CSS

App-Level Alert in the main-container
A new update is now available. Upgrade to v.1234.
Header

Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.

Custom Icon in an App-Level Alert
A new update is now available. Upgrade to v.1234.
Header

Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.

Angular

clrAlertClosable set to false. Default value is true.
clrAlertType set to alert-success. Default value is alert-info. Accepts values same as the static alert type classes.
clrAlertSizeSmall set to true. Default value is false.
Binding to the clrAlertClosedChange event.
clrAlertAppLevel set to true. Default is false.
Multiple app level alerts can be displayed with previous and next buttons.

Accessibility

Actionable controls inside dynamically generated alerts are not accessible to screen reader users! For this reason Clarity does not recommend using dropdowns, buttons, links inside alerts that appear as dynamic notifications.

Accessibility problems related to using actionable controls inside dynamically generated alerts:

  • They are announced as part of the alert message, which is out of context and may be confusing. For example, the following alert will be announced as "success acknowledge": TODO Fix core components (maybe it cannot be used in the markdown rendering)
  • There is no way for the user to directly interact with the announced action controls.

It is acceptable to use actions in static alerts. The following guidelines are recommended:

  • Controls can be dropdown, button or link elements.
  • Buttons should be used for actions, links for navigation.
  • The text for these controls should be as descriptive as possible. Acknowledge Action Link