Bootstrap 5 Multi-Step Form Wizard with Progress Bar
A four-step sign-up wizard with a numbered stepper, an animated progress bar, per-step validation and a success screen.
<section class="wdw-stage">
<div class="container" style="max-width: 640px;">
<div class="wdw-card overflow-hidden">
<div class="wdw-aurora wz-band px-4 py-4 text-center">
<span class="wdw-eyebrow text-white-50">Sign up</span>
<h1 class="h3 wdw-heading mt-1 mb-1 text-white">Create your account</h1>
<p class="mb-0 text-white-50">Complete each step to get started.</p>
</div>
<div class="p-4 p-md-5">
<ol class="wz-steps list-unstyled d-flex mb-3" id="wzSteps" aria-hidden="true">
<li class="wz-step active" aria-current="step"><span class="wz-dot">1</span><span class="wz-name">Account</span></li>
<li class="wz-step"><span class="wz-dot">2</span><span class="wz-name">Personal</span></li>
<li class="wz-step"><span class="wz-dot">3</span><span class="wz-name">Photo</span></li>
<li class="wz-step"><span class="wz-dot">4</span><span class="wz-name">Finish</span></li>
</ol>
<div class="progress wz-progress mb-4" role="progressbar" aria-label="Form completion" aria-valuemin="0" aria-valuemax="100" aria-valuenow="25" id="wzProgress">
<div class="progress-bar" style="width:25%"></div>
</div>
<form id="wzForm" novalidate>
<fieldset class="wz-pane" data-step="1">
<legend tabindex="-1" class="h5 fw-bold mb-3 d-flex justify-content-between align-items-baseline">Account information <small class="wdw-muted fw-normal">Step 1 of 4</small></legend>
<div class="d-grid gap-3">
<div class="form-floating"><input type="email" class="form-control" id="wzEmail" placeholder="Email" required><label for="wzEmail">Email</label><div class="invalid-feedback">Enter a valid email.</div></div>
<div class="form-floating"><input type="text" class="form-control" id="wzUser" placeholder="Username" required><label for="wzUser">Username</label><div class="invalid-feedback">Choose a username.</div></div>
<div class="row g-3">
<div class="col-sm-6"><div class="form-floating"><input type="password" class="form-control" id="wzPass" placeholder="Password" minlength="8" required><label for="wzPass">Password</label><div class="invalid-feedback">Min. 8 characters.</div></div></div>
<div class="col-sm-6"><div class="form-floating"><input type="password" class="form-control" id="wzPass2" placeholder="Confirm" required><label for="wzPass2">Confirm password</label><div class="invalid-feedback">Passwords must match.</div></div></div>
</div>
</div>
</fieldset>
<fieldset class="wz-pane" data-step="2" hidden>
<legend tabindex="-1" class="h5 fw-bold mb-3 d-flex justify-content-between align-items-baseline">Personal information <small class="wdw-muted fw-normal">Step 2 of 4</small></legend>
<div class="d-grid gap-3">
<div class="row g-3">
<div class="col-sm-6"><div class="form-floating"><input type="text" class="form-control" id="wzFirst" placeholder="First name" required><label for="wzFirst">First name</label><div class="invalid-feedback">Required.</div></div></div>
<div class="col-sm-6"><div class="form-floating"><input type="text" class="form-control" id="wzLast" placeholder="Last name" required><label for="wzLast">Last name</label><div class="invalid-feedback">Required.</div></div></div>
</div>
<div class="form-floating"><input type="tel" class="form-control" id="wzPhone" placeholder="Contact number" required><label for="wzPhone">Contact number</label><div class="invalid-feedback">Required.</div></div>
<div class="form-floating"><input type="tel" class="form-control" id="wzPhone2" placeholder="Alternate number"><label for="wzPhone2">Alternate number (optional)</label></div>
</div>
</fieldset>
<fieldset class="wz-pane" data-step="3" hidden>
<legend tabindex="-1" class="h5 fw-bold mb-3 d-flex justify-content-between align-items-baseline">Upload images <small class="wdw-muted fw-normal">Step 3 of 4</small></legend>
<div class="d-grid gap-3">
<label class="wz-drop" for="wzPhoto"><span class="wdw-icon"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 16V4M7 9l5-5 5 5M4 20h16"/></svg></span><span class="fw-semibold">Your photo</span><span class="small wdw-muted wz-fname" data-empty="Drop an image or click to browse">Drop an image or click to browse</span><input type="file" class="visually-hidden" id="wzPhoto" accept="image/*"></label>
<label class="wz-drop" for="wzSign"><span class="wdw-icon"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 16V4M7 9l5-5 5 5M4 20h16"/></svg></span><span class="fw-semibold">Signature</span><span class="small wdw-muted wz-fname" data-empty="Drop an image or click to browse">Drop an image or click to browse</span><input type="file" class="visually-hidden" id="wzSign" accept="image/*"></label>
</div>
</fieldset>
<fieldset class="wz-pane text-center py-3" data-step="4" hidden>
<legend class="visually-hidden">Finish</legend>
<span class="wz-check mb-3"><svg width="34" height="34" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span>
<h2 class="h4 wdw-heading">You are all set</h2>
<p class="wdw-muted mb-0">Your account has been created. Check your inbox to confirm your email.</p>
</fieldset>
<div class="d-flex justify-content-between gap-2 mt-4" id="wzActions">
<button type="button" class="btn btn-outline-primary rounded-pill px-4" id="wzPrev" disabled style="visibility:hidden">Previous</button>
<button type="button" class="btn btn-primary rounded-pill px-4" id="wzNext">Next</button>
</div>
</form>
</div>
</div>
</div>
</section>
/* Web Designer Wall library style — shared base for every Bootstrap 5 snippet.
Indigo accent, Plus Jakarta Sans, soft cards, pill buttons. Works in light and dark. */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");
:root,
[data-bs-theme="light"] {
--wdw-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--bs-body-font-family: var(--wdw-font);
--bs-primary: #4f46e5;
--bs-primary-rgb: 79, 70, 229;
--bs-primary-text-emphasis: #3730a3;
--bs-primary-bg-subtle: #eef2ff;
--bs-primary-border-subtle: #c7d2fe;
--bs-link-color: #4f46e5;
--bs-link-color-rgb: 79, 70, 229;
--bs-link-hover-color: #4338ca;
--bs-link-hover-color-rgb: 67, 56, 202;
--bs-focus-ring-color: rgba(79, 70, 229, 0.25);
--bs-border-radius: 0.75rem;
--bs-border-radius-lg: 1rem;
--bs-border-radius-xl: 1.25rem;
--wdw-radius-card: 1.25rem;
--wdw-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 16px 40px -16px rgba(16, 24, 40, 0.22);
--wdw-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px -4px rgba(16, 24, 40, 0.12);
--wdw-stage: #f5f6fb;
}
[data-bs-theme="dark"] {
--bs-primary: #818cf8;
--bs-primary-rgb: 129, 140, 248;
--bs-primary-text-emphasis: #c7d2fe;
--bs-primary-bg-subtle: rgba(129, 140, 248, 0.14);
--bs-primary-border-subtle: rgba(129, 140, 248, 0.35);
--bs-link-color: #a5b4fc;
--bs-link-color-rgb: 165, 180, 252;
--bs-link-hover-color: #c7d2fe;
--bs-link-hover-color-rgb: 199, 210, 254;
--bs-focus-ring-color: rgba(129, 140, 248, 0.35);
--wdw-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
--wdw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
--wdw-stage: #0f1117;
}
body { font-family: var(--wdw-font); -webkit-font-smoothing: antialiased; }
/* Bootstrap compiles its blue into these components; point them at the accent. */
.btn-primary {
--bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
--bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
--bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0f1117; --bs-btn-hover-bg: #a5b4fc; --bs-btn-hover-border-color: #a5b4fc; --bs-btn-hover-color: #0f1117; --bs-btn-active-color: #0f1117; }
.btn-outline-primary {
--bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary);
--bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn { --bs-btn-font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn-sm { min-height: 36px; }
.form-control, .form-select { min-height: 44px; border-radius: .75rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: rgba(var(--bs-primary-rgb), .6); box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.nav { --bs-nav-link-color: var(--bs-secondary-color); --bs-nav-link-hover-color: var(--bs-emphasis-color); }
.pagination { --bs-pagination-active-bg: var(--bs-primary); --bs-pagination-active-border-color: var(--bs-primary); --bs-pagination-color: var(--bs-body-color); --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--bs-primary); }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--bs-primary); border-radius: .875rem; box-shadow: var(--wdw-shadow-sm); }
.accordion { --bs-accordion-active-bg: var(--bs-primary-bg-subtle); --bs-accordion-active-color: var(--bs-primary-text-emphasis); --bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.badge { font-weight: 600; }
/* Library building blocks — use these instead of re-inventing them per snippet. */
.wdw-stage { min-height: 100vh; display: flex; align-items: center; background: var(--wdw-stage); padding-block: 3rem; }
.wdw-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: var(--wdw-radius-card); box-shadow: var(--wdw-shadow); }
.wdw-card-sm { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 1rem; box-shadow: var(--wdw-shadow-sm); }
.wdw-aurora { position: relative; color: #fff; background: radial-gradient(60% 55% at 100% 0, #818cf8 0, transparent 70%), radial-gradient(65% 60% at 0 100%, #ec4899 0, transparent 65%), #1e1b4b; }
.wdw-eyebrow { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-primary); }
.wdw-heading { font-weight: 800; letter-spacing: -.02em; color: var(--bs-emphasis-color); }
.wdw-muted { color: var(--bs-secondary-color); }
.wdw-icon { width: 2.75rem; height: 2.75rem; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: .875rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
/* Component */
.wz-steps { position: relative; justify-content: space-between; padding: 0; }
.wz-steps::before { content: ""; position: absolute; top: 18px; left: 12.5%; right: 12.5%; height: 2px; background: var(--bs-border-color); }
.wz-steps::after { content: ""; position: absolute; top: 18px; left: 12.5%; width: calc(75% * var(--wz-fill, 0)); height: 2px; background: var(--bs-primary); transition: width .35s; }
.wz-step { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; font-size: .8125rem; font-weight: 600; color: var(--bs-secondary-color); }
.wz-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--bs-body-bg); border: 2px solid var(--bs-border-color); font-weight: 700; transition: all .3s; z-index: 1; }
.wz-step.active { color: var(--bs-emphasis-color); }
.wz-step.active .wz-dot { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; box-shadow: 0 0 0 5px var(--bs-primary-bg-subtle); }
[data-bs-theme="dark"] .wz-step.active .wz-dot { color: #0f1117; }
.wz-step.done .wz-dot { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; font-size: 0; position: relative; }
[data-bs-theme="dark"] .wz-step.done .wz-dot { color: #0f1117; }
.wz-step.done .wz-dot::after { content: ""; width: 10px; height: 6px; border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(-45deg) translate(1px,-1px); }
.wz-band { padding-block: 1.75rem !important; }
.wz-progress { height: 6px; border-radius: 99px; }
.wz-progress .progress-bar { border-radius: 99px; transition: width .35s ease; }
#wzPrev:disabled { --bs-btn-disabled-color: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary); }
.wz-drop { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; padding: 1.25rem; border: 2px dashed var(--bs-border-color); border-radius: 1rem; background: var(--bs-tertiary-bg); cursor: pointer; transition: border-color .2s, background-color .2s; }
.wz-drop:hover, .wz-drop:focus-within { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.wz-drop.has-file { border-style: solid; border-color: var(--bs-primary); }
.wz-drop img { width: 56px; height: 56px; object-fit: cover; border-radius: .75rem; }
.wz-pane { border: 0; padding: 0; min-width: 0; animation: wzIn .35s ease; }
.wz-pane[hidden] { display: none; }
.wz-pane legend { float: none; width: 100%; padding: 0; }
.wz-check { width: 4.5rem; height: 4.5rem; border-radius: 50%; display: inline-grid; place-items: center; background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
@keyframes wzIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wz-pane { animation: none; } .wz-dot, .wz-steps::after, .wz-progress .progress-bar { transition: none; } }
@media (max-width: 420px) { .wz-name { font-size: .7rem; } }
function initWizard() {
const form = document.getElementById('wzForm');
if (!form) return;
const panes = [...form.querySelectorAll('.wz-pane')];
const steps = [...document.querySelectorAll('#wzSteps .wz-step')];
const progress = document.getElementById('wzProgress');
const bar = progress.querySelector('.progress-bar');
const prev = document.getElementById('wzPrev');
const next = document.getElementById('wzNext');
let current = 0;
const valid = () => {
const fields = [...panes[current].querySelectorAll('input')];
const pass = form.querySelector('#wzPass');
const pass2 = form.querySelector('#wzPass2');
if (current === 0) pass2.setCustomValidity(pass.value === pass2.value ? '' : 'Passwords must match');
let ok = true;
fields.forEach((f) => { f.classList.toggle('is-invalid', !f.checkValidity()); if (!f.checkValidity()) ok = false; });
return ok;
};
const render = (initial) => {
panes.forEach((p, i) => { p.hidden = i !== current; });
steps.forEach((s, i) => {
s.classList.toggle('active', i === current);
s.classList.toggle('done', i < current);
if (i === current) s.setAttribute('aria-current', 'step'); else s.removeAttribute('aria-current');
});
document.getElementById('wzSteps').style.setProperty('--wz-fill', current / (panes.length - 1));
const pct = ((current + 1) / panes.length) * 100;
bar.style.width = pct + '%';
progress.setAttribute('aria-valuenow', pct);
prev.disabled = current === 0;
prev.style.visibility = current === 0 ? 'hidden' : '';
prev.hidden = current === panes.length - 1;
next.hidden = current === panes.length - 1;
next.textContent = current === panes.length - 2 ? 'Submit' : 'Next';
if (!initial) { const lg = panes[current].querySelector('legend'); if (lg) lg.focus({ preventScroll: true }); }
};
render(true);
form.querySelectorAll('.wz-drop input').forEach((inp) => inp.addEventListener('change', () => {
const box = inp.closest('.wz-drop');
const name = box.querySelector('.wz-fname');
const old = box.querySelector('img'); if (old) old.remove();
const f = inp.files[0];
box.classList.toggle('has-file', !!f);
name.textContent = f ? f.name : name.dataset.empty;
if (f) { const im = document.createElement('img'); im.alt = 'Preview of ' + f.name; im.src = URL.createObjectURL(f); box.prepend(im); }
}));
next.addEventListener('click', () => { if (valid() && current < panes.length - 1) { current++; render(); } });
prev.addEventListener('click', () => { if (current > 0) { current--; render(); } });
form.addEventListener('submit', (e) => e.preventDefault());
form.addEventListener('input', (e) => { if (e.target.classList.contains('is-invalid') && e.target.checkValidity()) e.target.classList.remove('is-invalid'); });
}
initWizard();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.