Bootstrap 5 Animated Login and Registration Form
A split login and registration card where a side panel slides the panels apart to switch between the two forms.
<section class="wdw-stage">
<div class="container" style="max-width:960px">
<div class="wdw-card overflow-hidden auth" id="auth" data-mode="login">
<div class="auth-stage">
<div class="auth-panel wdw-aurora d-flex flex-column justify-content-center p-4 p-lg-5 text-center text-md-start">
<div class="auth-copy auth-copy-login">
<h2 class="fw-bold mb-2">New here?</h2>
<p class="opacity-75 mb-4">Create an account in under a minute and get started right away.</p>
<button type="button" class="btn btn-outline-light rounded-pill px-4" data-auth-switch="register">Register</button>
</div>
<div class="auth-copy auth-copy-register">
<h2 class="fw-bold mb-2">Welcome back</h2>
<p class="opacity-75 mb-4">Already have an account? Sign in to continue where you left off.</p>
<button type="button" class="btn btn-outline-light rounded-pill px-4" data-auth-switch="login">Log in</button>
</div>
</div>
<div class="auth-formcol p-4 p-lg-5">
<div class="nav nav-pills rounded-pill bg-body-tertiary p-1 mb-4 auth-seg" role="group" aria-label="Choose login or register">
<button type="button" class="nav-link rounded-pill flex-fill active" data-auth-switch="login" aria-pressed="true">Log in</button>
<button type="button" class="nav-link rounded-pill flex-fill" data-auth-switch="register" aria-pressed="false">Register</button>
</div>
<div class="auth-forms">
<form class="auth-form auth-form-login" id="loginF" novalidate>
<h3 class="wdw-heading h3 mb-1">Log in</h3>
<p class="wdw-muted mb-3">Enter your details to access your account.</p>
<div class="d-grid gap-2 d-sm-flex mb-3">
<button type="button" class="btn btn-outline-secondary rounded-pill flex-fill"><svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true"><path fill="#4285F4" d="M22.5 12.2c0-.8-.1-1.5-.2-2.2H12v4.2h5.9a5 5 0 0 1-2.2 3.3v2.7h3.5c2-1.9 3.3-4.700 3.3-8z"/><path fill="#34A853" d="M12 23c3 0 5.400-1 7.200-2.700l-3.500-2.700c-1 .7-2.200 1-3.700 1-2.800 0-5.200-1.900-6-4.500H2.400v2.800A11 11 0 0 0 12 23z"/><path fill="#FBBC05" d="M6 14.100a6.600 6.600 0 0 1 0-4.200V7.100H2.400a11 11 0 0 0 0 9.800z"/><path fill="#EA4335" d="M12 5.400c1.600 0 3 .6 4.200 1.600l3.100-3.100A11 11 0 0 0 2.400 7.100L6 9.900c.8-2.600 3.200-4.500 6-4.500z"/></svg>Google</button>
<button type="button" class="btn btn-outline-secondary rounded-pill flex-fill"><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-.2.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.700 1.300 3.400 1 .1-.8.400-1.300.7-1.600-2.600-.3-5.200-1.300-5.200-5.700 0-1.300.4-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.7.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.300c0 .3.200.7.800.6A11.500 11.500 0 0 0 12 .5z"/></svg>GitHub</button>
</div>
<div class="d-flex align-items-center gap-3 mb-3 small wdw-muted"><hr class="flex-grow-1 m-0"><span>or continue with email</span><hr class="flex-grow-1 m-0"></div>
<div class="form-floating mb-3"><input type="email" class="form-control" id="alEmail" placeholder="Email" autocomplete="email" aria-describedby="alEmailErr" required><label for="alEmail">Email address</label><div class="invalid-feedback" id="alEmailErr">Enter a valid email address.</div></div>
<div class="form-floating mb-3 position-relative"><input type="password" class="form-control pe-5" id="alPass" placeholder="Password" autocomplete="current-password" aria-describedby="alPassErr" required><label for="alPass">Password</label><button type="button" class="btn btn-link position-absolute top-0 end-0 mt-2 me-2 p-0 au-eye" data-pw-toggle="alPass" aria-controls="alPass" aria-pressed="false" aria-label="Show password"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8S1 12 1 12z"/><circle cx="12" cy="12" r="3"/></svg></button><div class="invalid-feedback" id="alPassErr">Enter your password.</div></div>
<div class="d-flex justify-content-between align-items-center mb-3">
<div class="form-check mb-0"><input class="form-check-input" type="checkbox" id="alRem"><label class="form-check-label" for="alRem">Remember me</label></div>
<a href="#" class="small link-primary text-decoration-none fw-semibold">Forgot?</a>
</div>
<button type="submit" class="btn btn-primary rounded-pill w-100">Log in</button>
</form>
<form class="auth-form auth-form-register" id="registerF" novalidate aria-hidden="true">
<h3 class="wdw-heading h3 mb-1">Create account</h3>
<p class="wdw-muted mb-3">It only takes a minute.</p>
<div class="d-grid gap-2 d-sm-flex mb-3">
<button type="button" class="btn btn-outline-secondary rounded-pill flex-fill"><svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true"><path fill="#4285F4" d="M22.5 12.2c0-.8-.1-1.5-.2-2.2H12v4.2h5.9a5 5 0 0 1-2.2 3.3v2.7h3.5c2-1.9 3.3-4.700 3.3-8z"/><path fill="#34A853" d="M12 23c3 0 5.400-1 7.200-2.700l-3.500-2.700c-1 .7-2.200 1-3.700 1-2.800 0-5.200-1.900-6-4.500H2.400v2.800A11 11 0 0 0 12 23z"/><path fill="#FBBC05" d="M6 14.100a6.600 6.600 0 0 1 0-4.200V7.100H2.400a11 11 0 0 0 0 9.800z"/><path fill="#EA4335" d="M12 5.400c1.600 0 3 .6 4.200 1.600l3.100-3.100A11 11 0 0 0 2.400 7.100L6 9.900c.8-2.600 3.200-4.500 6-4.500z"/></svg>Google</button>
<button type="button" class="btn btn-outline-secondary rounded-pill flex-fill"><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-.2.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.700 1.300 3.400 1 .1-.8.400-1.300.7-1.600-2.600-.3-5.200-1.300-5.200-5.700 0-1.300.4-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.7.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.300c0 .3.200.7.800.6A11.500 11.500 0 0 0 12 .5z"/></svg>GitHub</button>
</div>
<div class="d-flex align-items-center gap-3 mb-3 small wdw-muted"><hr class="flex-grow-1 m-0"><span>or sign up with email</span><hr class="flex-grow-1 m-0"></div>
<div class="form-floating mb-3"><input type="text" class="form-control" id="arName" placeholder="Name" autocomplete="name" aria-describedby="arNameErr" required tabindex="-1"><label for="arName">Full name</label><div class="invalid-feedback" id="arNameErr">Enter your name.</div></div>
<div class="form-floating mb-3"><input type="email" class="form-control" id="arEmail" placeholder="Email" autocomplete="email" aria-describedby="arEmailErr" required tabindex="-1"><label for="arEmail">Email address</label><div class="invalid-feedback" id="arEmailErr">Enter a valid email address.</div></div>
<div class="form-floating mb-3 position-relative"><input type="password" class="form-control pe-5" id="arPass" placeholder="Password" autocomplete="new-password" minlength="8" aria-describedby="arPassErr" required tabindex="-1"><label for="arPass">Password (8+ characters)</label><button type="button" class="btn btn-link position-absolute top-0 end-0 mt-2 me-2 p-0 au-eye" data-pw-toggle="arPass" aria-controls="arPass" aria-pressed="false" aria-label="Show password"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8S1 12 1 12z"/><circle cx="12" cy="12" r="3"/></svg></button><div class="invalid-feedback" id="arPassErr">Use at least 8 characters.</div></div>
<div class="form-check mb-3"><input class="form-check-input" type="checkbox" id="arTerms" aria-describedby="arTermsErr" required tabindex="-1"><label class="form-check-label small" for="arTerms">I agree to the <a href="#" class="link-primary fw-semibold text-decoration-none">Terms</a> and <a href="#" class="link-primary fw-semibold text-decoration-none">Privacy Policy</a></label><div class="invalid-feedback" id="arTermsErr">Please accept the terms to continue.</div></div>
<button type="submit" class="btn btn-primary rounded-pill w-100" tabindex="-1">Create account</button>
</form>
</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 */
.auth-stage{position:relative}
.auth-panel{overflow:hidden;display:grid!important;align-content:center}
.auth-copy{grid-area:1/1;transition:opacity .4s,transform .6s}
.auth-copy-register{opacity:0;visibility:hidden;pointer-events:none}
.auth[data-mode=register] .auth-copy-login{opacity:0;visibility:hidden;pointer-events:none}
.auth[data-mode=register] .auth-copy-register{opacity:1;visibility:visible;pointer-events:auto}
.auth-forms{display:grid}
.auth-form{grid-area:1/1;transition:opacity .4s,visibility .4s}
.auth-form-register{opacity:0;visibility:hidden}
.auth[data-mode=register] .auth-form-login{opacity:0;visibility:hidden}
.auth[data-mode=register] .auth-form-register{opacity:1;visibility:visible}
.auth .form-floating>.form-control{height:calc(3.5rem + 2px)}
.auth-seg .nav-link{min-height:40px;font-weight:600}
.au-eye{width:36px;height:36px;min-height:36px;color:var(--bs-secondary-color);display:inline-flex;align-items:center;justify-content:center}
.au-eye[aria-pressed=true]{color:var(--bs-primary)}
.auth hr{opacity:.15}
@media (min-width:768px){
.auth-panel{position:absolute;top:0;bottom:0;left:0;width:50%;z-index:2;transition:transform .7s cubic-bezier(.65,0,.35,1)}
.auth-formcol{margin-left:50%;transition:transform .7s cubic-bezier(.65,0,.35,1)}
.auth[data-mode=register] .auth-panel{transform:translateX(100%)}
.auth[data-mode=register] .auth-formcol{transform:translateX(-100%)}
}
@media (max-width:767.98px){.auth-panel{min-height:auto}.auth-copy .btn{display:none}.auth-copy p{margin-bottom:0!important}}
@media (prefers-reduced-motion:reduce){.auth-copy,.auth-form,.auth-panel,.auth-formcol{transition:none!important}}
(function initAuthToggle() {
var root = document.getElementById('auth');
if (!root) return;
var forms = { login: document.getElementById('loginF'), register: document.getElementById('registerF') };
function setMode(mode, focus) {
root.dataset.mode = mode;
Object.keys(forms).forEach(function (k) {
var active = k === mode;
forms[k].setAttribute('aria-hidden', active ? 'false' : 'true');
forms[k].querySelectorAll('input,button,a').forEach(function (el) {
if (active) el.removeAttribute('tabindex'); else el.tabIndex = -1;
});
});
root.querySelectorAll('.auth-seg [data-auth-switch]').forEach(function (b) {
var on = b.dataset.authSwitch === mode;
b.classList.toggle('active', on);
b.setAttribute('aria-pressed', String(on));
});
if (focus) {
var first = forms[mode].querySelector('input');
if (first) first.focus({ preventScroll: true });
}
}
root.querySelectorAll('[data-auth-switch]').forEach(function (b) {
b.addEventListener('click', function () { setMode(b.dataset.authSwitch, true); });
});
root.querySelectorAll('[data-pw-toggle]').forEach(function (b) {
b.addEventListener('click', function () {
var input = document.getElementById(b.dataset.pwToggle);
var show = input.type === 'password';
input.type = show ? 'text' : 'password';
b.setAttribute('aria-pressed', String(show));
});
});
Object.keys(forms).forEach(function (k) {
forms[k].addEventListener('submit', function (e) {
e.preventDefault();
forms[k].querySelectorAll('input[required]').forEach(function (f) { f.classList.toggle('is-invalid', !f.checkValidity()); });
});
});
})();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.