Alert boxes
An alert box is a small box that appears on the display screen to give you information, this is sometimes referred to as a message box.
Usage
The alert box should be placed on the page where it is visible to the relevant information that is displayed.
Use any icon from the icons page ensuring it reflects the alert box purpose.
For dynamic alert boxes use transitions, use one of the transition utilities to either make the alert collapse, fade or bounce.
Accessible attributes
Accessible attribute | Description |
---|---|
role="alertdialog" |
The alert dialog should be placed on the outer div of the alert to identify this element serves as an alert dialog container |
role="alert" |
The alert role should be placed on the outer div of the alert to identify this element serves as an alert notification |
aria-labelledby="IDREF" |
This gives the alert dialog an accessible name by referring to the element that provides the alert dialog title |
aria-describedby="IDREF" |
This gives the alert dialog an accessible description by referring to the alert dialog content that describes the primary message or purpose of the alert box |
aria-hidden="true" |
Tells assistive technologies that the windows underneath the current alert dialog are not available for interaction, when true the alert is displayed, otherwise false. |
Modifier selectors
Modifier selector | Description |
---|---|
slb-alert--blue |
Use blue alerts for primary information. |
slb-alert--grey |
Use grey alerts for secondary information. |
slb-alert--green |
Use green alerts for success information. |
slb-alert--red-solid |
Use red solid alerts for danger information. |
slb-alert--red |
Use red alerts for danger information. |
slb-alert--yellow |
Use yellow alerts for warning information. |
JavaScript Support
JavaScript Support class name | Description |
---|---|
slb-show |
This class will display the alert box on the page, remove and add the class name to display the alert dynamically |
General alert message. This is the text area which can contain paragraphs and anchor links.
General alert message. This is the text area which can contain paragraphs and anchor links.
General alert message. This is the text area which can contain paragraphs and anchor links.
General alert message. This is the text area which can contain paragraphs and anchor links.
General alert message. This is the text area which can contain paragraphs and anchor links.
General alert message. This is the text area which can contain paragraphs and anchor links.
alert-boxes\alert-box.hbs
<div class="slb-alert slb-show [modifier class]" role="alert" aria-labelledby="alertExample" aria-hidden="false">
<div class="slb-alert__icon-container">
<svg class="slb-alert__icon" viewBox="0 0 512 512" id="phone[modifier class]"><title>phone</title><path d="M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z"/></svg>
</div>
<div id="alertExample[modifier class]" class="slb-alert__text">
<p>General alert message. This is the text area which can contain paragraphs and <a href="#">anchor links</a>.</p>
</div>
</div>
components/_alert-box.scss