Stacking Banner
Description
The stacking banner is used to display one or more persistent alert messages at the top of a page. Unlike dismissible alerts, stacking banners remain visible for the duration of the user's session and cannot be closed. Banners stack vertically and span the full width of the page with no vertical space between them.
On smaller screens, banners are automatically grouped inside a collapsible accordion to reduce vertical space usage.
Definition
Each banner is built using Mosaic's Alert component.
All banners are wrapped in a .stacking-banner container using Mosaic's
accordion markup. On large screens, the accordion chrome (toggle buttons, borders,
and collapse behavior) is hidden via CSS and the banners render as a flat stack.
On small screens, the full accordion interaction is presented to reduce vertical
space usage. No JavaScript or conditional rendering is required.
Examples
Single stacking banner
Multiple stacking banners
Accessibility
Each banner uses aria-label="Site notice" to provide a description
of the element to assistive technology. Icons within the banner use aria-hidden="true" and focusable="false" to prevent redundant announcements, as the
icon is decorative and the text content conveys the full meaning. When the accordion
is visible on small screens, Bootstrap's collapse plugin manages the aria-expanded attribute on each toggle button automatically.
Guidelines
- Banners span the full width of the page.
- When multiple banners are present, they stack vertically in the order they appear in the markup with no vertical space between them.
- Banners are not anchored (sticky) to the top of the viewport. They scroll with the page content.
- There is no dismiss variant. Banners remain visible as long as the back-end condition that triggers them persists.
- Content and text wrap as screen size decreases. Text is never truncated, as banners convey important messaging.
- Links within banner content are inline and styled using the standard anchor element.
- On small screens, banners collapse into an accordion automatically. The same markup is used at all breakpoints.