Bootstrap 5 Multi-Step Registration Form with Validation
A three-step registration wizard with inline validation, a password strength meter and a review step before submitting.
<section class="wdw-stage">
<div class="container" style="max-width:980px">
<div class="wdw-card overflow-hidden" id="regWiz">
<div class="row g-0">
<aside class="col-md-5 wdw-aurora text-white p-4 p-md-5 d-flex flex-column justify-content-center">
<span class="wdw-eyebrow text-white-50">Create your account</span>
<h2 class="wdw-heading h3 text-white mt-1 mb-3">Everything you need, in one place</h2>
<ul class="list-unstyled d-grid gap-3 mb-0 small">
<li class="d-flex gap-2"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg>Free forever for personal projects</li>
<li class="d-flex gap-2"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg>Sync across all your devices</li>
<li class="d-flex gap-2"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg>No credit card, cancel any time</li>
</ul>
</aside>
<div class="col-md-7 p-4 p-md-5">
<ol class="wz-steps list-unstyled d-flex align-items-center mb-4" aria-label="Registration progress">
<li class="wz-step" data-ind><span class="wz-dot" aria-hidden="true">1</span><span class="visually-hidden">Step 1</span></li>
<li class="wz-line" aria-hidden="true"></li>
<li class="wz-step" data-ind><span class="wz-dot" aria-hidden="true">2</span><span class="visually-hidden">Step 2</span></li>
<li class="wz-line" aria-hidden="true"></li>
<li class="wz-step" data-ind><span class="wz-dot" aria-hidden="true">3</span><span class="visually-hidden">Step 3</span></li>
</ol>
<span class="wdw-eyebrow">Step <span data-step-now>1</span> of 3</span>
<h1 class="wdw-heading h3 mt-1 mb-4" data-step-title tabindex="-1">Your details</h1>
<form novalidate>
<div data-pane="0">
<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 autocomplete="given-name"><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 autocomplete="family-name"><label for="wzLast">Last name</label><div class="invalid-feedback">Required.</div></div></div>
<div class="col-12"><div class="form-floating"><input type="date" class="form-control" id="wzBirth" placeholder="Birthday" required max="2012-12-31" autocomplete="bday"><label for="wzBirth">Birthday</label><div class="invalid-feedback">Enter a valid date.</div></div></div>
<div class="col-12">
<fieldset><legend class="form-label small fw-semibold">Gender</legend>
<div class="btn-group w-100" role="group">
<input type="radio" class="btn-check" name="wzGender" id="wzF" checked><label class="btn btn-outline-primary rounded-start-pill" for="wzF">Female</label>
<input type="radio" class="btn-check" name="wzGender" id="wzM"><label class="btn btn-outline-primary" for="wzM">Male</label>
<input type="radio" class="btn-check" name="wzGender" id="wzO"><label class="btn btn-outline-primary rounded-end-pill" for="wzO">Prefer not to say</label>
</div></fieldset>
</div>
</div>
</div>
<div data-pane="1" hidden>
<div class="form-floating mb-3"><input type="email" class="form-control" id="wzEmail" placeholder="Email" required autocomplete="email"><label for="wzEmail">Email address</label><div class="invalid-feedback">Enter a valid email address.</div></div>
<div class="form-floating mb-2"><input type="password" class="form-control" id="wzPass" placeholder="Password" required minlength="8" autocomplete="new-password"><label for="wzPass">Password</label><div class="invalid-feedback">Use at least 8 characters.</div></div>
<div class="d-flex align-items-center gap-2 mb-3" aria-live="polite">
<div class="progress flex-grow-1" style="height:4px"><div class="progress-bar" data-meter style="width:0"></div></div>
<small class="text-body-secondary" data-meter-label style="min-width:3.5rem"> </small>
</div>
<div class="form-floating"><input type="password" class="form-control" id="wzPass2" placeholder="Confirm" required autocomplete="new-password"><label for="wzPass2">Confirm password</label><div class="invalid-feedback">Passwords do not match.</div></div>
</div>
<div data-pane="2" hidden>
<dl class="bg-body-tertiary rounded-4 p-3 mb-3 small">
<div class="d-flex justify-content-between py-1"><dt class="fw-normal text-body-secondary">Name</dt><dd class="mb-0 fw-semibold" data-sum="name"></dd></div>
<div class="d-flex justify-content-between py-1"><dt class="fw-normal text-body-secondary">Birthday</dt><dd class="mb-0 fw-semibold" data-sum="birth"></dd></div>
<div class="d-flex justify-content-between py-1"><dt class="fw-normal text-body-secondary">Email</dt><dd class="mb-0 fw-semibold" data-sum="email"></dd></div>
</dl>
<div class="form-check mb-2"><input class="form-check-input" type="checkbox" id="wzTerms" required><label class="form-check-label" for="wzTerms">I accept the <a href="#" class="link-primary">terms of service</a></label><div class="invalid-feedback">You must accept to continue.</div></div>
<div class="form-check"><input class="form-check-input" type="checkbox" id="wzNews"><label class="form-check-label" for="wzNews">Send me product updates</label></div>
</div>
<div class="alert alert-success d-flex gap-2 align-items-center mt-3 mb-0" role="status" data-done hidden>Account created. Welcome aboard! (Demo only)</div>
<div class="d-flex gap-2 mt-4" data-nav>
<button type="button" class="btn btn-outline-secondary rounded-pill px-4" data-back hidden>Back</button>
<button type="button" class="btn btn-primary rounded-pill flex-grow-1" data-next>Continue</button>
</div>
</form>
</div>
</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 */
#regWiz [data-pane]:not([hidden]) { animation: wzIn .3s ease; }
@keyframes wzIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #regWiz [data-pane]:not([hidden]) { animation: none; } }
#regWiz .btn-outline-secondary { --bs-btn-color: var(--bs-body-color); --bs-btn-border-color: var(--bs-border-color); --bs-btn-hover-bg: var(--bs-tertiary-bg); --bs-btn-hover-color: var(--bs-emphasis-color); --bs-btn-hover-border-color: var(--bs-border-color); }
#regWiz .progress-bar { transition: width .3s ease, background-color .3s ease; }
#regWiz dd { text-align: right; word-break: break-all; }
#regWiz [hidden] { display: none !important; }
#regWiz .wz-steps { gap: .5rem; }
#regWiz .wz-line { flex: 1; height: 2px; background: var(--bs-border-color); }
#regWiz .wz-dot { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid var(--bs-border-color); color: var(--bs-secondary-color); font-weight: 700; font-size: .875rem; transition: all .2s; }
#regWiz .wz-step.is-current .wz-dot { border-color: var(--bs-primary); color: var(--bs-primary); }
#regWiz .wz-step.is-done .wz-dot { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; font-size: 0; }
#regWiz .wz-step.is-done .wz-dot::before { content: ""; width: .8rem; height: .45rem; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px,-1px); }
#regWiz .wz-line.is-done { background: var(--bs-primary); }
#regWiz [data-step-title]:focus { outline: none; }
#regWiz .btn-group .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
function initRegWizard() {
const root = document.getElementById('regWiz');
if (!root) return;
const panes = [...root.querySelectorAll('[data-pane]')];
const titles = ['Your details', 'Secure your account', 'Review & finish'];
const inds = [...root.querySelectorAll('[data-ind]')];
const lines = [...root.querySelectorAll('.wz-line')];
const heading = root.querySelector('[data-step-title]');
const next = root.querySelector('[data-next]');
const back = root.querySelector('[data-back]');
const pass = root.querySelector('#wzPass');
const pass2 = root.querySelector('#wzPass2');
let step = 0;
const fmtDate = (iso) => { const d = new Date(iso + 'T00:00:00'); return isNaN(d) ? iso : d.toLocaleDateString(undefined, { year: 'numeric', month: 'long', day: 'numeric' }); };
const validPane = (pane) => {
let ok = true;
pane.querySelectorAll('input[required]').forEach((el) => {
if (el === pass2) el.setCustomValidity(el.value === pass.value ? '' : 'mismatch');
const good = el.checkValidity();
el.classList.toggle('is-invalid', !good);
el.classList.toggle('is-valid', good && el.type !== 'checkbox');
if (!good) ok = false;
});
return ok;
};
const show = (focus) => {
panes.forEach((p, i) => { p.hidden = i !== step; });
root.querySelector('[data-step-now]').textContent = step + 1;
root.querySelector('[data-step-title]').textContent = titles[step];
inds.forEach((li, i) => {
li.classList.toggle('is-done', i < step);
li.classList.toggle('is-current', i === step);
if (i === step) li.setAttribute('aria-current', 'step'); else li.removeAttribute('aria-current');
});
lines.forEach((ln, i) => ln.classList.toggle('is-done', i < step));
back.hidden = step === 0;
next.textContent = step === panes.length - 1 ? 'Create account' : 'Continue';
if (step === 2) {
const v = (id) => root.querySelector(id).value;
root.querySelector('[data-sum="name"]').textContent = v('#wzFirst') + ' ' + v('#wzLast');
root.querySelector('[data-sum="birth"]').textContent = fmtDate(v('#wzBirth'));
root.querySelector('[data-sum="email"]').textContent = v('#wzEmail');
}
if (focus) heading.focus();
};
show();
next.addEventListener('click', () => {
if (!validPane(panes[step])) { panes[step].querySelector('.is-invalid')?.focus(); return; }
if (step < panes.length - 1) { step++; show(true); return; }
root.querySelector('[data-done]').hidden = false;
root.querySelector('[data-nav]').hidden = true;
});
back.addEventListener('click', () => { if (step > 0) { step--; show(true); } });
root.addEventListener('input', (e) => { if (e.target.matches('.is-invalid, .is-valid')) validPane(e.target.closest('[data-pane]')); });
const meter = root.querySelector('[data-meter]');
const label = root.querySelector('[data-meter-label]');
pass.addEventListener('input', () => {
const v = pass.value;
const score = (v.length >= 8) + /[A-Z]/.test(v) + /\d/.test(v) + /[^A-Za-z0-9]/.test(v);
const lv = v ? Math.max(1, score) : 0;
meter.style.width = lv * 25 + '%';
meter.className = 'progress-bar ' + ['', 'bg-danger', 'bg-warning', 'bg-primary', 'bg-success'][lv];
label.textContent = ['', 'Weak', 'Fair', 'Good', 'Strong'][lv] || ' ';
});
}
initRegWizard();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.