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).

A simple primary alert—check it out!
A simple secondary alert—check it out!
A simple success alert—check it out!
A simple danger alert—check it out!
A simple warning alert—check it out!
A simple info alert—check it out!
A simple light alert—check it out!
A simple dark alert—check it out!
<alert color="primary">
  A simple primary alert—check it out!
</alert>
<alert color="secondary">
  A simple secondary alert—check it out!
</alert>
<alert color="success">
  A simple success alert—check it out!
</alert>
<alert color="danger">
  A simple danger alert—check it out!
</alert>
<alert color="warning">
  A simple warning alert—check it out!
</alert>
<alert color="info">
  A simple info alert—check it out!
</alert>
<alert color="light">
  A simple light alert—check it out!
</alert>
<alert color="dark">
  A simple dark alert—check it out!
</alert>
<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.

Well done!

Aww yeah, you successfully read this important alert message. This example text with a link is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.

Whenever you need to, be sure to use margin utilities to keep things nice and tidy.

<alert color="success">
  <title><icon outputclass="bi-emoji-smile" padding="e2"/>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>
</alert>
<section outputclass="alert 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 a @color attribute or an @outputclass.

<note color="primary">
  This is a primary note.
</note>
<note color="secondary">
  This is a secondary note.
</note>
<note color="light">
  This is light note.
</note>
<note color="dark">
  This is dark note.
</note>
<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 @icon attribute or @otherprops to alter the default icon.

<note icon="bi-search" type="other" othertype="Search">
  This note has a search icon.
</note>
<note icon="bi bi-emoji-smile" style="font-size: 2rem; color: cornflowerblue;" type="note">
  This note uses a styled smile emoji.
</note>
<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>