Toast

Toast

Toast is a stack of alerts pinned to a corner of the viewport. In a real page use a popover="manual" element so it opens on top without JavaScript.

Class names

Class nameTypeDescription
toastComponentFixed stack of alerts; bottom end of the viewport by default
toast-topModifierPin to the top instead of the bottom
toast-startModifierPin to the inline-start side
toast-centerModifierCenter horizontally
toast-staticModifierKeep in normal flow instead of fixed; for demos and inline stacks

Toast

Shown with toast-static so it stays in the page. In a real page drop toast-static and the stack pins to the bottom end of the viewport.

Changes saved.
Syncing in the background.
<div class="toast toast-static">
  <div class="alert alert-success" role="status">Changes saved.</div>
  <div class="alert alert-info" role="status">Syncing in the background.</div>
</div>

Popover toast

A popover="manual" toast opens in the top layer and fades in. It stays until closed, so include a close button. Without toast-static it appears at the bottom end of the viewport; add toast-top, toast-start or toast-center to move it.

Changes saved.
<button type="button" class="btn" popovertarget="toast-ex2">Show toast</button>
<div id="toast-ex2" class="toast" popover="manual" role="status">
  <div class="alert alert-success">
    Changes saved.
    <button type="button" class="btn btn-ghost btn-sm" popovertarget="toast-ex2" popovertargetaction="hide">Close</button>
  </div>
</div>

Stacked alerts

Upload complete.
Storage almost full.
<div class="toast toast-static">
  <div class="alert alert-success" role="status">Upload complete.</div>
  <div class="alert alert-warning" role="status">Storage almost full.</div>
  <div class="alert alert-danger" role="alert">Payment failed.</div>
</div>