Government of Spain Dintel Standardized Design of Electronic Procedures Start First steps Foundations Components Modules Templates Tokens Support

Alert

Alerts are direct notifications with users, they are used to give urgent feedback on something that is happening in the application. But they can also be annoying if they are used at inappropriate times or in excess.

Preview

Figma

Uses

In general, it is important to use alerts in an interface strategically and considering the context of use. A good practice is to limit the number of alerts displayed and allow the user to control the frequency or notifications.

When to use

Important status changes or updates. Confirmation of a specific action. Background events that have been completed or a problem has occurred.

When not to use

It is not an important or urgent situation. The information can be displayed in a less intrusive manner, such as in an interface state or in a status bar. It can annoy the user or disrupt their workflow Too many alerts are used, which can cause the user to ignore them

Behaviour

The alert component appears integrated into the content and implies a warning that can disappear automatically after a period of time or by clicking on the user.

We will choose the type of alert depending on the type of alert: error, information, success or alert. We will use the alerts as and when necessary, without saturating the user with information.

In the message we will show the precise information of what is happening, adapting to the particular situation in each case.

Types

Simple
With title
With link
Close

States

Display of the alert component in informative status
Info
Display of the alert component in warning state
Warning
Display of the alert component in error state
Error
Visualization of the alert component in a successful state
Success

Accessibility

This component has been validated to meet the accessibility requirements of UNE-EN 301549:2022, which includes the criteria of WCAG 2.1 (AA), however, changes in content and styles can affect accessibility compliance. We must make sure to review and follow the guidelines in this section when you update or add new content or style to this component.

Hazard and warning alerts have a defined role="alert" that ensures assistive technologies announce them when they appear. The default and success alert variations have defined a role="status". This ensures that they are read after the hazard and warning alerts. The alerts also use tabindex="0" to make it possible to access them with the tab key or to move the focus to them by programming. Through the h-size property the developer can choose the appropriate header tag for the alert title The closing blade has role="button" in addition to the aria-label property.