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 name | Type | Description |
|---|---|---|
toast | Component | Fixed stack of alerts; bottom end of the viewport by default |
toast-top | Modifier | Pin to the top instead of the bottom |
toast-start | Modifier | Pin to the inline-start side |
toast-center | Modifier | Center horizontally |
toast-static | Modifier | Keep 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.
Payment failed.
<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>