Alert

Alert

Alerts show a message inline. Add a status color, and use role="alert" for urgent messages or role="status" for passive ones.

Playground

Flip a class and watch it change. The markup below follows along.

A neutral message with no status color.

Color
<div class="alert" role="status">
  <p>A neutral message with no status color.</p>
</div>

Class names

Class nameTypeDescription
alertComponentBase alert; a leading `<svg>` is colored by the accent
alert-titlePartBold heading line
alert-infoColorInformational
alert-successColorSuccess
alert-warningColorWarning
alert-dangerColorError or destructive outcome

Alert

A neutral message with no status color.

<div class="alert" role="status">
  <p>A neutral message with no status color.</p>
</div>

Colors

New version available.

Your changes were saved.

Your trial ends in 3 days.

<div class="alert alert-info" role="status">
  <p>New version available.</p>
</div>
<div class="alert alert-success" role="status">
  <p>Your changes were saved.</p>
</div>
<div class="alert alert-warning" role="status">
  <p>Your trial ends in 3 days.</p>
</div>
<div class="alert alert-danger" role="alert">
  <p>Payment failed.</p>
</div>

With a title

Heads up

Maintenance is scheduled for Sunday at 02:00 UTC.

<div class="alert alert-info" role="status">
  <div>
    <p class="alert-title">Heads up</p>
    <p>Maintenance is scheduled for Sunday at 02:00 UTC.</p>
  </div>
</div>

With an icon

A direct child <svg> is sized and colored by the alert. Mark it aria-hidden.

Deployed

Version 1.2.0 is live.

<div class="alert alert-success" role="status">
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M5 13l4 4L19 7"/></svg>
  <div>
    <p class="alert-title">Deployed</p>
    <p>Version 1.2.0 is live.</p>
  </div>
</div>

Urgent alert

role="alert" interrupts screen readers; reserve it for errors that need attention now.

<div class="alert alert-danger" role="alert">
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M12 8v5M12 16.5v.5"/><circle cx="12" cy="12" r="9"/></svg>
  <div>
    <p class="alert-title">Upload failed</p>
    <p>The file is larger than 10 MB.</p>
  </div>
</div>

With an action

Unsaved changes

Leaving now will discard your edits.

<div class="alert alert-warning" role="status">
  <div>
    <p class="alert-title">Unsaved changes</p>
    <p>Leaving now will discard your edits.</p>
  </div>
  <button class="btn btn-sm">Save draft</button>
</div>