Alerts

Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.

Example

Alerts are available for any length of text, as well as an optional close button. For proper styling, use one of the eight required contextual classes (e.g., set @outputclass to alert-success).

<section outputclass="alert-primary">
  A simple primary alert—check it out!
</section>
<section outputclass="alert-secondary">
  A simple secondary alert—check it out!
</section>
<section outputclass="alert-success">
  A simple success alert—check it out!
</section>
<section outputclass="alert-danger">
  A simple danger alert—check it out!
</section>
<section outputclass="alert-warning">
  A simple warning alert—check it out!
</section>
<section outputclass="alert-info">
  A simple info alert—check it out!
</section>
<section outputclass="alert-light">
  A simple light alert—check it out!
</section>
<section outputclass="alert-dark">
  A simple dark alert—check it out!
</section>

Additional content

Alerts can also contain additional HTML elements like headings, paragraphs, icons and links.

<section outputclass="alert-success">
  <title><i outputclass="bi bi-emoji-smile pe-2"/>Well done!</title>
  <p>
    Aww yeah, you successfully read this important alert message. This example text with a
    <xref href="#">link</xref> is going to run a bit longer so that you can see
    how spacing within an alert works with this kind of content.
  </p>
  <p>
    Whenever you need to, be sure to use margin utilities to keep things nice and tidy.
  </p>
</section>

Notes

DITA <note> elements are displayed as alerts according to the @type attribute. With the exception @type="othertype", an icon is added if @type is present.

<note type="note">This is just a note.</note>
<note type="notice">Notice this piece of information.</note>
<note type="fastpath">This note will speed you on your way.</note>
<note type="remember">Don't forget to do what this note says.</note>
<note type="tip">This is a fine little tip.</note>
<note type="attention">Please pay extra attention to this note.</note>
<note type="caution">Care is required when proceeding.</note>
<note type="important">This note is important.</note>
<note type="restriction">You can't do what this note says.</note>
<note type="danger">You may hurt yourself!</note>
<note type="other" othertype="Another note">This is something other than a normal note.</note>

The default colors can be overridden by using an @outputclass.

<note type="note" outputclass="alert-primary">This is a primary note.</note>
<note type="note" outputclass="alert-secondary">This is a secondary note.</note>
<note type="note" outputclass="alert-light">This is light note.</note>
<note type="note" outputclass="alert-dark">This is dark note.</note>

Use an additional @otherprops to alter the default icon, use CSS font-size and color to change the icon appearance.

<note otherprops="icon(bi-search)" type="other" othertype="Search">This note has a search icon.</note>
<note otherprops="icon(bi-emoji-smile), style(font-size: 2rem; color: cornflowerblue;)" type="note" othertype="Another note">This note uses a styled smile emoji.</note>