Banner

View Storybook

A banner is a type of notice, delivering system and engagement messaging. It is highly intrusive and should be used sparingly and appropriately.

Overview

System banners are used for system messaging. They are full-width notices placed in one of two locations:

  1. Above everything else: If the banner is related to the entire app (e.g. the user lost internet service), place the banner first. These should not be dismissable until the issue is resolved. To pin the banner to the top of the app, add the .d-notice--pinned class.
  2. Below the top bar: This is the default location for system banners. Use these when it affects only a particular area of the product (e.g. when the user is in Do Not Disturb mode).

Banners are a type of notice and so you can use the following notice styles in conjunction with .d-banner.

Classes

Class Applies to Description
.d-banner N/A Base parent banner class. This defaults to the system banner style.
.d-banner__dialog N/A Contains the banner content.
.d-banner--error .d-banner Applies error visual style.
.d-banner--info .d-banner Applies info visual style.
.d-banner--success .d-banner Applies success visual style.
.d-banner--warning .d-banner Applies warning visual style.
.d-banner--important .d-banner Adds the higher importance style by emboldening the background color. These should only be used for pressing information that needs to be noticed by the user.
.d-banner--pinned .d-banner Pins the banner to the top of the window and pushes all app content down.

Examples

Accessibility

Item Applies to Description
role="alert" .d-banner Provides the user with important, and usually time-sensitive information, often telling the user an element has been updated (Source)
aria-hidden="[true|false]" .d-banner Informs assistive technologies, such as screen readers, if they should ignore the element. This should not be confused with the HTML hidden attribute which tells the browser to not display an element. (Source)
role="alertdialog" .d-banner__dialog Dialog which contains the alert message and where the initial focus goes to in an element within a dialog (Source)
aria-labelledby="[id]" .d-banner__dialog Only used if a title is present, it provides assistive technologies with a title for the dialog. (Source)
aria-label="[title]" .d-banner__dialog If aria-labelledby is not used (because no title is present), this must be used to provides assistive technologies with a title for the dialog. (Source)
aria-describedby="[id]" .d-banner__dialog Provides assistive technologies with the alert's descriptive copy (Source)