Menu

Content

Components

Utilities

Buy now

Toasts

Push notifications to your visitors with a toast, a lightweight and easily customizable alert message.

Bootstrap docs

Basic example

<!-- Basic toast example (remove fade show to hide toast initially) -->
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false">
  <div class="toast-header">
    <div class="d-inline-block align-middle bg-primary rounded-circle me-2" style="width: 1.25rem; height: 1.25rem;"></div>
    <h6 class="mb-0 me-auto">Around</h6>
    <small class="fw-medium text-muted">11 mins ago</small>
    <button type="button" class="btn-close ms-2" data-bs-dismiss="toast" aria-label="Close"></button>
  </div>
  <div class="toast-body">Hello, world! This is a toast message.</div>
</div>
// Basic toast example (remove .fade .show to hide toast initially)
.toast.fade.show(role="alert", aria-live="assertive", aria-atomic="true", data-bs-autohide="false")
  .toast-header
    .d-inline-block.align-middle.bg-primary.rounded-circle.me-2(style="width: 1.25rem; height: 1.25rem;")
    h6.mb-0.me-auto Around
    small.fw-medium.text-muted 11 mins ago
    button(type="button", data-bs-dismiss="toast", aria-label="Close").btn-close.ms-2.mb-1
      span(aria-hidden="true") &times;
  .toast-body Hello, world! This is a toast message.

Color variations

<!-- Remove class show from toast to hide it initially. Remove data-bs-autohide="false" to enable autohide behavior. -->

<!-- Primary toast -->
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false">
  <div class="toast-header bg-primary text-white">
    <i class="ai-bell fs-lg me-2"></i>
    <span class="fw-medium me-auto">Primary toast</span>
    <button type="button" class="btn-close btn-close-white ms-2" data-bs-dismiss="toast" aria-label="Close"></button>
  </div>
  <div class="toast-body text-primary">Hello, world! This is a toast message.</div>
</div>

<!-- Secondary toast -->
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false">
  <div class="toast-header bg-secondary">
    <i class="ai-lock-open fs-lg me-2"></i>
    <span class="me-auto">Secondary toast</span>
    <button type="button" class="btn-close ms-2 mb-1" data-bs-dismiss="toast" aria-label="Close"></button>
  </div>
  <div class="toast-body">Hello, world! This is a toast message.</div>
</div>

<!-- Success toast -->
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false">
  <div class="toast-header bg-success text-white">
    <i class="ai-circle-check fs-lg me-2"></i>
    <span class="me-auto">Success toast</span>
    <button type="button" class="btn-close btn-close-white ms-2" data-bs-dismiss="toast" aria-label="Close"></button>
  </div>
  <div class="toast-body text-success">Hello, world! This is a toast message.</div>
</div>

<!-- Danger toast -->
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false">
  <div class="toast-header bg-danger text-white">
    <i class="ai-circle-slash fs-lg me-2"></i>
    <span class="me-auto">Danger toast</span>
    <button type="button" class="btn-close btn-close-white ms-2" data-bs-dismiss="toast" aria-label="Close"></button>
  </div>
  <div class="toast-body text-danger">Hello, world! This is a toast message.</div>
</div>

<!-- Warning toast -->
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false">
  <div class="toast-header bg-warning text-white">
    <i class="ai-triangle-alert fs-lg me-2"></i>
    <span class="me-auto">Warning toast</span>
    <button type="button" class="btn-close btn-close-white ms-2" data-bs-dismiss="toast" aria-label="Close"></button>
  </div>
  <div class="toast-body text-warning">Hello, world! This is a toast message.</div>
</div>

<!-- Info toast -->
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false">
  <div class="toast-header bg-info text-white">
    <i class="ai-circle-info fs-lg me-2"></i>
    <span class="me-auto">Info toast</span>
    <button type="button" class="btn-close btn-close-white ms-2" data-bs-dismiss="toast" aria-label="Close"></button>
  </div>
  <div class="toast-body text-info">Hello, world! This is a toast message.</div>
</div>

<!-- Dark toast -->
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false">
  <div class="toast-header bg-dark text-white">
    <i class="ai-time fs-lg me-2"></i>
    <span class="me-auto">Dark toast</span>
    <button type="button" class="btn-close btn-close-white ms-2" data-bs-dismiss="toast" aria-label="Close"></button>
  </div>
  <div class="toast-body text-dark">Hello, world! This is a toast message.</div>
</div>

<!-- Custom color toast -->
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false">
  <div class="toast-header border-0 text-white" style="background-color: #69459e;">
    <i class="ai-map-pin fs-lg me-2"></i>
    <span class="me-auto">Custom color toast</span>
    <button type="button" class="btn-close btn-close-white ms-2" data-bs-dismiss="toast" aria-label="Close"></button>
  </div>
  <div class="toast-body" style="color: #69459e;">Hello, world! This is a toast message.</div>
</div>
// Remove class show from toast to hide it initially. Remove data-bs-autohide="false" to enable autohide behavior.

// Primary toast
.toast.fade.show(role="alert", aria-live="assertive", aria-atomic="true", data-bs-autohide="false")
  .toast-header.bg-primary.text-white
    i.ai-bell.fs-lg.me-2
    span.me-auto Primary toast
    button(type="button" data-bs-dismiss="toast" aria-label="Close").btn-close.btn-close-white.ms-2
  .toast-body.text-primary Hello, world! This is a toast message.

// Secondary toast
.toast.fade.show(role="alert", aria-live="assertive", aria-atomic="true", data-bs-autohide="false")
  .toast-header.bg-secondary
    i.ai-lock-open.fs-lg.me-2
    span.me-auto Secondary toast
    button(type="button" data-bs-dismiss="toast" aria-label="Close").btn-close.ms-2
  .toast-body Hello, world! This is a toast message.

// Success toast
.toast.fade.show(role="alert", aria-live="assertive", aria-atomic="true", data-bs-autohide="false")
  .toast-header.bg-success.text-white
    i.ai-circle-check.fs-lg.me-2
    span.me-auto Success toast
    button(type="button" data-bs-dismiss="toast" aria-label="Close").btn-close.btn-close-white.ms-2
  .toast-body.text-success Hello, world! This is a toast message.

// Danger toast
.toast.fade.show(role="alert", aria-live="assertive", aria-atomic="true", data-bs-autohide="false")
  .toast-header.bg-danger.text-white
    i.ai-circle-slash.fs-lg.me-2
    span.me-auto Danger toast
    button(type="button" data-bs-dismiss="toast" aria-label="Close").btn-close.btn-close-white.ms-2
  .toast-body.text-danger Hello, world! This is a toast message.

// Warning toast
.toast.fade.show(role="alert", aria-live="assertive", aria-atomic="true", data-bs-autohide="false")
  .toast-header.bg-warning.text-white
    i.ai-triangle-alert.fs-lg.me-2
    span.me-auto Warning toast
    button(type="button" data-bs-dismiss="toast" aria-label="Close").btn-close.btn-close-white.ms-2
  .toast-body.text-warning Hello, world! This is a toast message.

// Info toast
.toast.fade.show(role="alert", aria-live="assertive", aria-atomic="true", data-bs-autohide="false")
  .toast-header.bg-info.text-white
    i.ai-circle-info.fs-lg.me-2
    span.me-auto Info toast
    button(type="button" data-bs-dismiss="toast" aria-label="Close").btn-close.btn-close-white.ms-2
  .toast-body.text-info Hello, world! This is a toast message.

// Dark toast
.toast.fade.show(role="alert", aria-live="assertive", aria-atomic="true", data-bs-autohide="false")
  .toast-header.bg-dark.text-white
    i.ai-time.fs-lg.me-2
    span.me-auto Dark toast
    button(type="button" data-bs-dismiss="toast" aria-label="Close").btn-close.btn-close-white.ms-2
  .toast-body.text-dark Hello, world! This is a toast message.

// Custom color toast
.toast.fade.show(role="alert", aria-live="assertive", aria-atomic="true", data-bs-autohide="false")
  .toast-header.border-0.text-white(style="background-color: #69459e;")
    i.ai-map-pin.fs-lg.me-2
    span.me-auto Custom color toast
    button(type="button" data-bs-dismiss="toast" aria-label="Close").btn-close.btn-close-white.ms-2
  .toast-body(style="color: #69459e;") Hello, world! This is a toast message.