Toasts are as flexible as you need and have very little required markup. At a minimum, we require a single element to contain your "toasted" content and strongly encourage a dismiss button.
-<div class="bg-light">
{% capture example %}
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
</div>
</div>
{% endcapture %}
-{% include example.html content=example %}
-</div>
+{% include example.html content=example class="bg-light" %}
### Translucent
Toasts are slightly translucent, too, so they blend over whatever they might appear over. For browsers that support the `backdrop-filter` CSS property, we'll also attempt to blur the elements under a toast.
-<div class="bg-dark">
{% capture example %}
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
</div>
</div>
{% endcapture %}
-{% include example.html content=example %}
-</div>
+{% include example.html content=example class="bg-dark" %}
### Stacking
When you have multiple toasts, we default to vertically stacking them in a readable manner.
-<div class="bg-light">
{% capture example %}
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
</div>
</div>
{% endcapture %}
-{% include example.html content=example %}
-</div>
+{% include example.html content=example class="bg-light" %}
## Placement
Place toasts with custom CSS as you need them. The top right is often used for notifications, as is the top middle. If you're only ever going to show one toast at a time, put the positioning styles right on the `.toast`.
-<div class="bg-dark">
{% capture example %}
<div aria-live="polite" aria-atomic="true" style="position: relative; min-height: 200px;">
<div class="toast" style="position: absolute; top: 0; right: 0;">
</div>
</div>
{% endcapture %}
-{% include example.html content=example %}
-</div>
+{% include example.html content=example class="bg-dark" %}
For systems that generate more notifications, consider using a wrapping element so they can easily stack.
-<div class="bg-dark">
{% capture example %}
<div aria-live="polite" aria-atomic="true" style="position: relative; min-height: 200px;">
<!-- Position it -->
</div>
</div>
{% endcapture %}
-{% include example.html content=example %}
-</div>
+{% include example.html content=example class="bg-dark" %}
You can also get fancy with flexbox utilities to align toasts horizontally and/or vertically.
-<div class="bg-dark">
{% capture example %}
<!-- Flexbox container for aligning the toasts -->
<div aria-live="polite" aria-atomic="true" class="d-flex justify-content-center align-items-center" style="min-height: 200px;">
</div>
</div>
{% endcapture %}
-{% include example.html content=example %}
-</div>
+{% include example.html content=example class="bg-dark" %}
## Accessibility
When using `autohide: false`, you must add a close button to allow users to dismiss the toast.
-<div class="bg-light">
{% capture example %}
<div role="alert" aria-live="assertive" aria-atomic="true" class="toast" data-autohide="false">
<div class="toast-header">
</div>
</div>
{% endcapture %}
-{% include example.html content=example %}
-</div>
+{% include example.html content=example class="bg-light" %}
## JavaScript behavior