Bootstrap 5 Sign In / Sign Up Form with Switch
A split-screen authentication card that switches between sign in and sign up panels, with a photo panel beside the form.
<section class="wdw-stage">
<div class="container" style="max-width:900px">
<div class="wdw-card overflow-hidden" id="authCard">
<div class="row g-0">
<div class="col-md-6 p-4 p-md-5 order-1">
<p class="visually-hidden" role="status" aria-live="polite" id="authStatus"></p>
<div id="signinPane" class="wdw-pane">
<h2 class="wdw-heading h3 mb-1">Welcome back</h2>
<p class="wdw-muted mb-4">Sign in to your account to continue.</p>
<div class="d-flex gap-2 mb-3">
<button class="btn btn-outline-secondary text-body-emphasis flex-fill rounded-pill wdw-social" type="button"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20.500 12h-8M20 12a8.500 8.500 0 1 1-2.600-6.100"/></svg>Google</button>
<button class="btn btn-outline-secondary text-body-emphasis flex-fill rounded-pill wdw-social" type="button"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .5a11.500 11.500 0 0 0-3.600 22.400c.6.100.8-.3.8-.6v-2c-3.200.7-3.900-1.500-3.900-1.500-.5-1.300-1.300-1.700-1.300-1.700-1-.7.100-.7.100-.7 1.200.1 1.800 1.200 1.800 1.200 1 1.800 2.800 1.300 3.400 1 .1-.8.400-1.300.7-1.600-2.600-.3-5.300-1.300-5.300-5.700 0-1.300.5-2.300 1.200-3.100-.1-.3-.5-1.500.1-3.100 0 0 1-.3 3.200 1.200a11 11 0 0 1 5.800 0c2.200-1.500 3.200-1.200 3.200-1.200.6 1.600.2 2.800.1 3.100.8.800 1.200 1.800 1.200 3.100 0 4.400-2.700 5.400-5.300 5.700.4.400.8 1.100.8 2.200v3.200c0 .3.2.7.8.6A11.500 11.500 0 0 0 12 .5z"/></svg>GitHub</button>
</div>
<p class="text-center small wdw-muted mb-3">or use your email</p>
<form novalidate>
<div class="form-floating mb-3"><input type="email" class="form-control" id="inEmail" placeholder="Email" autocomplete="email"><label for="inEmail">Email</label></div>
<div class="form-floating mb-2"><input type="password" class="form-control" id="inPass" placeholder="Password" autocomplete="current-password"><label for="inPass">Password</label></div>
<a href="#" class="d-inline-block mb-4 fw-semibold link-underline link-underline-opacity-0 link-underline-opacity-100-hover">Forgot your password?</a>
<button class="btn btn-primary rounded-pill w-100" type="submit">Sign in</button>
</form>
<p class="d-md-none text-center small wdw-muted mt-3 mb-0">New here? <button type="button" class="btn btn-link p-0 align-baseline fw-semibold link-underline link-underline-opacity-0" data-switch>Create an account</button></p>
</div>
<div id="signupPane" class="wdw-pane" hidden>
<h2 class="wdw-heading h3 mb-1">Create account</h2>
<p class="wdw-muted mb-4">Join in less than a minute.</p>
<form novalidate>
<div class="form-floating mb-3"><input type="text" class="form-control" id="upName" placeholder="Name" autocomplete="name"><label for="upName">Full name</label></div>
<div class="form-floating mb-3"><input type="email" class="form-control" id="upEmail" placeholder="Email" autocomplete="email"><label for="upEmail">Email</label></div>
<div class="form-floating mb-1"><input type="password" class="form-control" id="upPass" placeholder="Password" autocomplete="new-password" aria-describedby="upHint"><label for="upPass">Password</label></div>
<p class="form-text small mb-3" id="upHint">Use 8 or more characters with a mix of letters and numbers.</p>
<div class="form-check mb-4 d-flex align-items-start gap-2 ps-0"><input class="form-check-input mt-1 flex-shrink-0 ms-0" type="checkbox" id="upTerms"><label class="form-check-label small" for="upTerms">I agree to the <a href="#" class="link-underline link-underline-opacity-0 link-underline-opacity-100-hover">terms</a> and <a href="#" class="link-underline link-underline-opacity-0 link-underline-opacity-100-hover">privacy policy</a>.</label></div>
<button class="btn btn-primary rounded-pill w-100" type="submit">Sign up</button>
</form>
<p class="d-md-none text-center small wdw-muted mt-3 mb-0">Already a member? <button type="button" class="btn btn-link p-0 align-baseline fw-semibold link-underline link-underline-opacity-0" data-switch>Sign in</button></p>
</div>
</div>
<div class="col-md-6 order-2 wdw-auth-side d-flex flex-column justify-content-end p-4 p-md-5 text-white">
<div class="position-relative">
<h3 class="wdw-heading text-white h2 mb-2" id="sideTitle">New here?</h3>
<p class="mb-4" id="sideText">Create an account and start booking tables in your favourite places.</p>
<button class="btn btn-light rounded-pill px-4" type="button" id="switchBtn" data-switch>Sign up</button>
</div>
</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 */
.wdw-auth-side { min-height: 220px; background: linear-gradient(180deg, rgba(15,15,35,.15), rgba(30,27,75,.9)), url("https://images.unsplash.com/photo-1517248135467-4c7edcad34c4?auto=format&fit=crop&w=900&q=70") center/cover, #1e1b4b; }
#authCard .row { min-height: 560px; }
@media (max-width: 767.98px) { #authCard .row { min-height: 0; } }
.wdw-social { --bs-btn-border-color: var(--bs-border-color); --bs-btn-hover-color: var(--bs-emphasis-color); --bs-btn-hover-bg: var(--bs-tertiary-bg); --bs-btn-hover-border-color: var(--bs-secondary-color); --bs-btn-active-color: var(--bs-emphasis-color); --bs-btn-active-bg: var(--bs-tertiary-bg); --bs-btn-active-border-color: var(--bs-secondary-color); }
.wdw-pane { transition: opacity .18s ease; }
.wdw-pane.is-out { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .wdw-pane { transition: none; } }
(function () {
function initAuthSwitch() {
var btn = document.getElementById('switchBtn'), status = document.getElementById('authStatus');
var inP = document.getElementById('signinPane'), upP = document.getElementById('signupPane');
var title = document.getElementById('sideTitle'), text = document.getElementById('sideText');
if (!btn || !inP || !upP) return;
var signup = false, busy = false;
function swap() {
signup = !signup;
var show = signup ? upP : inP, hide = signup ? inP : upP;
hide.hidden = true; hide.classList.remove('is-out');
show.classList.add('is-out'); show.hidden = false;
title.textContent = signup ? 'Already a member?' : 'New here?';
text.textContent = signup ? 'Sign in to pick up where you left off.' : 'Create an account and start booking tables in your favourite places.';
btn.textContent = signup ? 'Sign in' : 'Sign up';
if (status) status.textContent = signup ? 'Create account form shown' : 'Sign in form shown';
requestAnimationFrame(function () {
show.classList.remove('is-out');
show.querySelector('input').focus({ preventScroll: true });
busy = false;
});
}
function toggle() {
if (busy) return;
busy = true;
var cur = signup ? upP : inP;
cur.classList.add('is-out');
setTimeout(swap, window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 180);
}
document.querySelectorAll('[data-switch]').forEach(function (b) { b.addEventListener('click', toggle); });
document.querySelectorAll('#authCard form').forEach(function (f) { f.addEventListener('submit', function (e) { e.preventDefault(); }); });
}
initAuthSwitch();
})();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.