bootstrap 5 toast example

Example 1: set auto-hide toast javascrpt

$(".toast").toast({ autohide: false });

Example 2: bootstrap toast

<!-- Bootstrap 5 Toasts -->
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
   <div class="toast-header">
      <img src="..." class="rounded me-2" alt="..." />
      <strong class="me-auto">Bootstrap</strong>
      <small>11 mins ago</small>
      <button
         type="button"
         class="btn-close"
         data-bs-dismiss="toast"
         aria-label="Close"
      ></button>
   </div>
   <div class="toast-body">Hello, world! This is a toast message.</div>
</div>

Example 3: boostrap toast

<!-- 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;">

  <!-- Then put toasts within -->
  <div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
    <div class="toast-header">
      <img src="..." class="rounded mr-2" alt="...">
      <strong class="mr-auto">Bootstrap</strong>
      <small>11 mins ago</small>
      <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
        <span aria-hidden="true">×</span>
      </button>
    </div>
    <div class="toast-body">
      Hello, world! This is a toast messag e.
    </div>
  </div>
</div>

Example 4: using bootstrap toast in mvc view

<div class="container">
  <!-- Content here -->
</div>

Example 5: bootstrap toast

<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
  <div class="toast-header">
    <img src="..." class="rounded mr-2" alt="...">
    <strong class="mr-auto">Bootstrap</strong>
    <small>11 mins ago</small>
    <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
      <span aria-hidden="true">×</span>
    </button>
  </div>
  <div class="toast-body">
    Hello, world! This is a toast message.
  </div>
</div>

Example 6: Bootstrap 4 Toast

<div class="toast">
  <div class="toast-header">
    Toast Header
  </div>
  <div class="toast-body">
    Some text inside the toast body
  </div>
</div>