Snippets Form Wizard

Bootstrap 5 Multi-Step Form Wizard in a Modal

A launchable payment wizard in a modal, with a numbered progress stepper, sliding step transitions, per-step validation and a final review screen.

Bootstrap 5 No jQuery Jun 2020 4.2K views

<section class="wdw-stage">
  <div class="container" style="max-width:880px">
    <div class="wdw-card overflow-hidden">
      <div class="row g-0">
        <div class="col-md-5 wdw-aurora p-4 p-md-5 d-flex flex-column justify-content-between gap-4">
          <span class="badge rounded-pill text-bg-light align-self-start">Pro plan</span>
          <div>
            <div class="display-5 fw-bold lh-1">$24<span class="fs-6 fw-semibold opacity-75"> / month</span></div>
            <p class="small opacity-75 mt-2 mb-0">Billed monthly. Cancel anytime.</p>
          </div>
        </div>
        <div class="col-md-7 p-4 p-md-5">
          <span class="wdw-eyebrow">Checkout</span>
          <h1 class="wdw-heading h2 mt-1 mb-2">Multi-step wizard modal</h1>
          <p class="wdw-muted mb-4">Four short steps: account, personal details, payment and a final review.</p>
          <ol class="list-unstyled d-grid gap-2 mb-4 small">
            <li class="d-flex align-items-center gap-2"><span class="wdw-icon" style="width:1.75rem;height:1.75rem;border-radius:.5rem">1</span> Create your account</li>
            <li class="d-flex align-items-center gap-2"><span class="wdw-icon" style="width:1.75rem;height:1.75rem;border-radius:.5rem">2</span> Add personal details</li>
            <li class="d-flex align-items-center gap-2"><span class="wdw-icon" style="width:1.75rem;height:1.75rem;border-radius:.5rem">3</span> Enter payment</li>
            <li class="d-flex align-items-center gap-2"><span class="wdw-icon" style="width:1.75rem;height:1.75rem;border-radius:.5rem">4</span> Review and confirm</li>
          </ol>
          <button type="button" class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#wzModal">Launch wizard</button>
        </div>
      </div>
    </div>
  </div>
</section>

<div class="modal fade" id="wzModal" tabindex="-1" aria-labelledby="wzTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered modal-lg">
    <div class="modal-content border-0 wz-content overflow-hidden"><div class="row g-0"><aside class="col-md-4 wdw-aurora p-4 d-none d-md-flex flex-column justify-content-between" aria-label="Order summary"><span class="badge rounded-pill text-bg-light align-self-start">Pro plan</span><div><div class="display-6 fw-bold lh-1">$24<span class="fs-6 fw-semibold opacity-75"> / mo</span></div><ul class="list-unstyled small opacity-75 mt-3 mb-0 d-grid gap-1"><li>Unlimited projects</li><li>Team sharing</li><li>Priority support</li></ul></div></aside><div class="col-md-8 d-flex flex-column">
      <div class="modal-header border-0 pb-0 px-4 pt-4">
        <h2 class="modal-title h5 fw-bold" id="wzTitle">Create your account</h2>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body px-4 pb-2">
        <ol class="wz-steps list-unstyled d-flex mb-4 mt-2" aria-label="Progress"><li class="wz-step is-active" data-step="0"><span class="wz-dot" aria-hidden="true"><span class="wz-num">1</span><svg class="wz-check" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span><span class="wz-label"><span class="d-none d-sm-block small wdw-muted">Step 1</span><span class="fw-semibold small">Account</span></span></li><li class="wz-step" data-step="1"><span class="wz-dot" aria-hidden="true"><span class="wz-num">2</span><svg class="wz-check" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span><span class="wz-label"><span class="d-none d-sm-block small wdw-muted">Step 2</span><span class="fw-semibold small">Personal</span></span></li><li class="wz-step" data-step="2"><span class="wz-dot" aria-hidden="true"><span class="wz-num">3</span><svg class="wz-check" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span><span class="wz-label"><span class="d-none d-sm-block small wdw-muted">Step 3</span><span class="fw-semibold small">Payment</span></span></li><li class="wz-step" data-step="3"><span class="wz-dot" aria-hidden="true"><span class="wz-num">4</span><svg class="wz-check" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span><span class="wz-label"><span class="d-none d-sm-block small wdw-muted">Step 4</span><span class="fw-semibold small">Confirm</span></span></li></ol>
        <p class="visually-hidden" id="wzStatus" role="status" aria-live="polite">Step 1 of 4</p>
        <form id="wzForm" novalidate>
          <div class="wz-pane is-active" data-pane="0"><div class="row g-3">
            <div class="col-md-6"><div class="form-floating"><input type="text" class="form-control" id="wz-name" placeholder="Name" required autocomplete="name"><label for="wz-name">Name</label><div class="invalid-feedback">Enter your full name.</div></div></div>
            <div class="col-md-6"><div class="form-floating"><input type="email" class="form-control" id="wz-email" placeholder="Email" required autocomplete="email"><label for="wz-email">Email</label><div class="invalid-feedback">Enter a valid email, like [email protected].</div></div></div>
            <div class="col-md-6"><div class="form-floating"><input type="password" class="form-control" id="wz-pass" placeholder="Password" required minlength="6" autocomplete="new-password"><label for="wz-pass">Password</label><div class="invalid-feedback">Use at least 6 characters.</div></div></div>
            <div class="col-md-6"><div class="form-floating"><input type="password" class="form-control" id="wz-pass2" placeholder="Repeat password" required autocomplete="new-password"><label for="wz-pass2">Repeat password</label><div class="invalid-feedback">Passwords do not match.</div></div></div>
          </div></div>
          <div class="wz-pane" data-pane="1"><div class="row g-3">
            <div class="col-12"><div class="form-floating"><input type="text" class="form-control" id="wz-addr" placeholder="Address" required autocomplete="street-address"><label for="wz-addr">Address</label><div class="invalid-feedback">Enter your street address.</div></div></div>
            <div class="col-md-6"><div class="form-floating"><input type="text" class="form-control" id="wz-city" placeholder="City" required autocomplete="address-level2"><label for="wz-city">City</label><div class="invalid-feedback">Enter your city.</div></div></div>
            <div class="col-md-6"><div class="form-floating"><input type="text" class="form-control" id="wz-state" placeholder="State" required autocomplete="address-level1"><label for="wz-state">State</label><div class="invalid-feedback">Enter your state or region.</div></div></div>
            <div class="col-12"><div class="form-floating"><input type="text" class="form-control" id="wz-country" placeholder="Country" required autocomplete="country-name"><label for="wz-country">Country</label><div class="invalid-feedback">Enter your country.</div></div></div>
          </div></div>
          <div class="wz-pane" data-pane="2"><div class="row g-3">
            <div class="col-12"><div class="form-floating"><input type="text" class="form-control" id="wz-card" placeholder="Card number" required inputmode="numeric" pattern="[0-9 ]{12,19}" autocomplete="cc-number"><label for="wz-card">Card number</label><div class="invalid-feedback">Enter a 16-digit card number.</div></div></div>
            <div class="col-md-6"><div class="form-floating"><input type="text" class="form-control" id="wz-holder" placeholder="Card holder name" required autocomplete="cc-name"><label for="wz-holder">Card holder name</label><div class="invalid-feedback">Enter the name on the card.</div></div></div>
            <div class="col-md-3 col-6"><div class="form-floating"><input type="text" class="form-control" id="wz-cvv" placeholder="CVV" required inputmode="numeric" pattern="[0-9]{3,4}" autocomplete="cc-csc"><label for="wz-cvv">CVV</label><div class="invalid-feedback">3 or 4 digits.</div></div></div>
            <div class="col-md-3 col-6"><div class="form-floating"><input type="tel" class="form-control" id="wz-mobile" placeholder="Mobile" required autocomplete="tel"><label for="wz-mobile">Mobile</label><div class="invalid-feedback">Enter a mobile number.</div></div></div>
          </div></div>
          <div class="wz-pane" data-pane="3">
            <p class="wdw-muted mb-3">Review your details before you finish.</p>
            <dl class="row mb-0 wz-summary rounded-4 bg-body-tertiary p-3 mx-0 gx-0" id="wzSummary"></dl>
          </div>
          <div class="wz-pane text-center py-4" data-pane="done">
            <span class="wdw-icon mb-3" style="width:3.5rem;height:3.5rem"><svg width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span>
            <h3 class="h5 fw-bold">You are all set</h3>
            <p class="wdw-muted mb-0">Your account has been created.</p>
          </div>
        </form>
      </div>
      <div class="modal-footer border-0 px-4 pb-4 justify-content-between" id="wzFooter">
        <button type="button" class="btn btn-link text-body-secondary text-decoration-none px-3 invisible" id="wzBack">Back</button>
        <button type="button" class="btn btn-primary rounded-pill px-4" id="wzNext">Next <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button>
      </div>
    </div></div>
    </div>
  </div>
</div>

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.