Skip to content
Patternfly Logo

Alert group

An alert group stacks and positions 2 or more alerts in a live region, either in a layer over the main content of a page or inline with the page content. Alert groups should always rank alerts by age, stacking new alerts on top of old ones as they surface.

Examples

Static alert group

  • Success alert: Success alert title

  • Danger alert: Danger alert title

  • Info alert: Info alert title

    Info alert description. This is a link.

Overview

.pf-c-alert-group is optional when only one alert is needed. It becomes required when more than one alert is used in a list.

Usage

Attribute
Applied to
Outcome
.pf-c-alert-group
<ul>
Creates an alert group component. Required
.pf-c-alert-group__item
<li>
Creates an alert group item. Required

Toast alert group

Toast alert group screenshot

Overview

An alert group that includes the .pf-m-toast modifier becomes a toast alert group with unique positioning in the top-right corner of the window. .pf-c-alert-group is required to create a toast alert group.

Every toast alert must include a close button to dismiss the alert.

When toast alerts include a link or action, these elements are not announced as interactive elements by screen readers. Whenever you include a link or button, incorporate it into the message so that it’s clear to the user how to access the same contents or action without clicking the link or button directly in the toast. For example, if your toast alert displays a message “The build is complete. Go to the Builds page to download,” the screen reader user is given instructions on how to find their build for download.

For sighted users, interactive elements can be included in this message in one of the following ways:

  • Using a link to the Builds page: “The build is complete. Go to the Builds page to download” using <a href="url">Builds</a>
  • Using a button to download: “The build is complete. Go to the Builds page to download" using <button class="pf-c-button pf-m-link pf-m-inline type="button">download</button>

Modifiers

Class
Applied to
Outcome
.pf-m-toast
.pf-c-alert-group
Applies toast alert styling to an alert group.
.pf-c-alert-group__overflow-button
<button>
Applies overflow button styling to an alert group overflow button.

Documentation

Overview

Alert groups are used to contain and align consecutive alerts. Groups can either be embedded alongside a page's content or in the top-right corner as a toast group using the .pf-m-toast modifier.

CSS variables

.pf-c-alert-group--pf-c-alert-group__item--MarginTop
0.5rem
.pf-c-alert-group--pf-c-alert-group--m-toast--Top
3rem
.pf-c-alert-group--pf-c-alert-group--m-toast--Right
2rem
.pf-c-alert-group--pf-c-alert-group--m-toast--MaxWidth
37.5rem
.pf-c-alert-group--pf-c-alert-group--m-toast--ZIndex
600
.pf-c-alert-group--pf-c-alert-group__overflow-button--BorderWidth
0
.pf-c-alert-group--pf-c-alert-group__overflow-button--PaddingTop
1.5rem
.pf-c-alert-group--pf-c-alert-group__overflow-button--PaddingRight
1rem
.pf-c-alert-group--pf-c-alert-group__overflow-button--PaddingBottom
1.5rem
.pf-c-alert-group--pf-c-alert-group__overflow-button--PaddingLeft
1rem
.pf-c-alert-group--pf-c-alert-group__overflow-button--Color
#06c
.pf-c-alert-group--pf-c-alert-group__overflow-button--BoxShadow
0 0.5rem 1rem 0 rgba(3, 3, 3, 0.16), 0 0 0.375rem 0 rgba(3, 3, 3, 0.08)
.pf-c-alert-group--pf-c-alert-group__overflow-button--BackgroundColor
#fff
.pf-c-alert-group--pf-c-alert-group__overflow-button--hover--Color
#004080
.pf-c-alert-group--pf-c-alert-group__overflow-button--hover--BoxShadow
0 0.5rem 1rem 0 rgba(3, 3, 3, 0.16), 0 0 0.375rem 0 rgba(3, 3, 3, 0.08), 0 0.75rem 0.75rem -0.5rem rgba(3, 3, 3, 0.18)
.pf-c-alert-group--pf-c-alert-group__overflow-button--focus--Color
#004080
.pf-c-alert-group--pf-c-alert-group__overflow-button--focus--BoxShadow
0 0.5rem 1rem 0 rgba(3, 3, 3, 0.16), 0 0 0.375rem 0 rgba(3, 3, 3, 0.08), 0 0.75rem 0.75rem -0.5rem rgba(3, 3, 3, 0.18)
.pf-c-alert-group--pf-c-alert-group__overflow-button--active--Color
#004080
.pf-c-alert-group--pf-c-alert-group__overflow-button--active--BoxShadow
0 0.5rem 1rem 0 rgba(3, 3, 3, 0.16), 0 0 0.375rem 0 rgba(3, 3, 3, 0.08), 0 0.75rem 0.75rem -0.5rem rgba(3, 3, 3, 0.18)
.pf-c-alert-group__overflow-button:hover--pf-c-alert-group__overflow-button--Color
#004080
.pf-c-alert-group__overflow-button:hover--pf-c-alert-group__overflow-button--BoxShadow
0 0.5rem 1rem 0 rgba(3, 3, 3, 0.16), 0 0 0.375rem 0 rgba(3, 3, 3, 0.08), 0 0.75rem 0.75rem -0.5rem rgba(3, 3, 3, 0.18)
.pf-c-alert-group__overflow-button:focus--pf-c-alert-group__overflow-button--Color
#004080
.pf-c-alert-group__overflow-button:focus--pf-c-alert-group__overflow-button--BoxShadow
0 0.5rem 1rem 0 rgba(3, 3, 3, 0.16), 0 0 0.375rem 0 rgba(3, 3, 3, 0.08), 0 0.75rem 0.75rem -0.5rem rgba(3, 3, 3, 0.18)
.pf-c-alert-group__overflow-button:active--pf-c-alert-group__overflow-button--Color
#004080
.pf-c-alert-group__overflow-button:active--pf-c-alert-group__overflow-button--BoxShadow
0 0.5rem 1rem 0 rgba(3, 3, 3, 0.16), 0 0 0.375rem 0 rgba(3, 3, 3, 0.08), 0 0.75rem 0.75rem -0.5rem rgba(3, 3, 3, 0.18)

View source on GitHub