Snippets Alert

Bootstrap 5 Success Alert Modal with Animated Checkmark

A success alert pattern with a centred confirmation dialog that animates a drawn checkmark, plus a compact toast for quieter feedback. Both are built on native Bootstrap components, so no extra alert library is needed.

Bootstrap 5 No jQuery Dec 2019 3.4K views

<section class="wdw-stage">
  <div class="container" style="max-width: 920px">
    <div class="text-center mb-5">
      <span class="wdw-eyebrow">Alerts & popups</span>
      <h1 class="h2 wdw-heading mt-1 mb-2">Success message</h1>
      <p class="wdw-muted mb-0">A confirmation dialog for important actions, and a lightweight toast for everything else.</p>
    </div>
    <div class="row g-4 align-items-stretch">
      <div class="col-md-7">
        <p class="small fw-semibold text-body-secondary text-uppercase mb-2">Dialog</p>
        <div class="wdw-card success-modal success-inline text-center p-4 p-md-5 h-100 d-flex flex-column justify-content-center">
          <div class="success-check mx-auto mb-4" aria-hidden="true">
            <svg viewBox="0 0 52 52" width="44" height="44" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path class="success-tick" d="M14 27l9 9 16-18"/></svg>
          </div>
          <h2 class="h4 wdw-heading mb-2">Payment successful</h2>
          <p class="wdw-muted mb-4">Your order has been placed. A receipt is on its way to your inbox.</p>
          <div class="d-grid gap-2 d-sm-flex justify-content-center">
            <button type="button" class="btn btn-primary rounded-pill px-4">Done</button>
            <button type="button" class="btn btn-outline-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#successModal">Open as modal</button>
          </div>
        </div>
      </div>
      <div class="col-md-5">
        <p class="small fw-semibold text-body-secondary text-uppercase mb-2">Toast</p>
        <div class="wdw-card p-4 h-100 d-flex flex-column justify-content-center gap-4">
          <div class="toast show w-100 bg-body border rounded-4 shadow-sm" role="presentation">
            <div class="toast-body d-flex align-items-center gap-3 fw-semibold">
              <span class="success-dot" aria-hidden="true"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span>
              Changes saved successfully.
            </div>
          </div>
          <button type="button" class="btn btn-outline-primary rounded-pill" id="showToast">Show toast</button>
        </div>
      </div>
    </div>
  </div>

  <div class="modal fade" id="successModal" tabindex="-1" aria-labelledby="successTitle" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" style="max-width: 400px">
      <div class="modal-content border-0 text-center p-4 p-md-5 success-modal">
        <div class="success-check mx-auto mb-4" aria-hidden="true">
          <svg viewBox="0 0 52 52" width="44" height="44" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path class="success-tick" d="M14 27l9 9 16-18"/></svg>
        </div>
        <h2 class="h4 wdw-heading mb-2" id="successTitle">Payment successful</h2>
        <p class="wdw-muted mb-4">Your order has been placed. A receipt is on its way to your inbox.</p>
        <button type="button" class="btn btn-primary rounded-pill w-100" data-bs-dismiss="modal">Done</button>
      </div>
    </div>
  </div>

  <div class="toast-container position-fixed bottom-0 end-0 p-3">
    <div class="toast align-items-center bg-body border rounded-4 shadow" role="status" aria-live="polite" aria-atomic="true" id="successToast">
      <div class="d-flex align-items-center">
        <div class="toast-body d-flex align-items-center gap-3 fw-semibold">
          <span class="success-dot" aria-hidden="true"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span>
          Changes saved successfully.
        </div>
        <button type="button" class="btn-close me-3 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.

Free to use in personal and commercial projects under the MIT license.