Bootstrap 5 Sign In / Sign Up Form with Slide Effect
A sign-in and sign-up card where a photo overlay slides across to reveal the other form, collapsing to a simple text switch on phones.
<section class="wdw-stage">
<div class="container" style="max-width:960px">
<div class="wdw-auth wdw-card overflow-hidden" id="auth" data-mode="signin">
<div class="wdw-auth-panel wdw-auth-signin p-4 p-sm-5" id="panel-signin">
<h1 class="wdw-heading h2 mb-1">Welcome back</h1>
<p class="wdw-muted mb-4">Sign in to pick up where you left off.</p>
<div class="row g-2 mb-3">
<div class="col-6"><button type="button" class="btn btn-outline-secondary text-body rounded-pill w-100">
<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="M19 7.5A8 8 0 1 0 20 12h-8"/></svg>
Google</button></div>
<div class="col-6"><button type="button" class="btn btn-outline-secondary text-body rounded-pill w-100">
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2a10 10 0 0 0-3.2 19.5c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.5 2.4 1.1 3 .8.1-.7.4-1.1.6-1.4-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .8-.3 2.8 1a9.6 9.600 0 0 1 5 0c1.9-1.300 2.8-1 2.8-1 .5 1.400.2 2.4.1 2.7.6.7 1 1.600 1 2.7 0 3.900-2.400 4.7-4.6 5 .4.3.7.9.7 1.9v2.8c0 .3.2.6.7.5A10 10 0 0 0 12 2z"/></svg>
GitHub</button></div>
</div>
<div class="wdw-or small wdw-muted mb-3"><span>or use email</span></div>
<form class="d-grid gap-3" onsubmit="return false">
<div class="form-floating"><input type="email" class="form-control" id="si-email" placeholder="Email" autocomplete="email"><label for="si-email">Email</label></div>
<div class="input-group">
<div class="form-floating flex-grow-1"><input type="password" class="form-control" id="si-pass" placeholder="Password" autocomplete="current-password"><label for="si-pass">Password</label></div>
<button type="button" class="btn btn-outline-secondary wdw-eye" data-toggle-pass="si-pass" aria-label="Show password" aria-pressed="false">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg>
</button>
</div>
<div class="d-flex justify-content-between align-items-center">
<div class="form-check mb-0"><input class="form-check-input" type="checkbox" id="si-remember"><label class="form-check-label small" for="si-remember">Remember me</label></div>
<a href="#" class="small link-underline link-underline-opacity-0 link-underline-opacity-100-hover">Forgot your password?</a>
</div>
<button type="submit" class="btn btn-primary rounded-pill">Sign in</button>
</form>
<p class="small wdw-muted text-center mt-3 mb-0 d-md-none">New here? <button type="button" class="btn btn-link p-0 align-baseline small wdw-switch-link" data-switch="signup">Create an account</button></p>
</div>
<div class="wdw-auth-panel wdw-auth-signup p-4 p-sm-5" id="panel-signup">
<h2 class="wdw-heading h2 mb-1">Create account</h2>
<p class="wdw-muted mb-4">It takes less than a minute.</p>
<form class="d-grid gap-3" onsubmit="return false">
<div class="form-floating"><input type="text" class="form-control" id="su-name" placeholder="Name" autocomplete="name"><label for="su-name">Full name</label></div>
<div class="form-floating"><input type="email" class="form-control" id="su-email" placeholder="Email" autocomplete="email"><label for="su-email">Email</label></div>
<div class="input-group">
<div class="form-floating flex-grow-1"><input type="password" class="form-control" id="su-pass" placeholder="Password" autocomplete="new-password"><label for="su-pass">Password</label></div>
<button type="button" class="btn btn-outline-secondary wdw-eye" data-toggle-pass="su-pass" aria-label="Show password" aria-pressed="false">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg>
</button>
</div>
<div class="form-check mb-0"><input class="form-check-input" type="checkbox" id="su-terms"><label class="form-check-label small" for="su-terms">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 type="submit" class="btn btn-primary rounded-pill">Sign up</button>
</form>
<p class="small wdw-muted text-center mt-3 mb-0 d-md-none">Already a member? <button type="button" class="btn btn-link p-0 align-baseline small wdw-switch-link" data-switch="signin">Sign in</button></p>
</div>
<div class="wdw-auth-overlay wdw-aurora d-none d-md-block">
<div class="wdw-auth-copy" id="copy-signin">
<span class="wdw-brand-mark mb-3" aria-hidden="true"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l9 5-9 5-9-5 9-5z"/><path d="M3 13l9 5 9-5"/></svg></span>
<h2 class="fw-bold mb-2">New here?</h2>
<p class="mb-3 opacity-75">Enter your details and start the journey with us.</p>
<ul class="wdw-bullets list-unstyled text-start mb-4">
<li>Save your favourite places</li><li>Sync across every device</li><li>Free for your first 30 days</li>
</ul>
<button type="button" class="btn btn-outline-light rounded-pill px-4" data-switch="signup">Sign up</button>
</div>
<div class="wdw-auth-copy" id="copy-signup">
<span class="wdw-brand-mark mb-3" aria-hidden="true"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l9 5-9 5-9-5 9-5z"/><path d="M3 13l9 5 9-5"/></svg></span>
<h2 class="fw-bold mb-2">Hello, friend!</h2>
<p class="mb-3 opacity-75">Already have an account? Sign in to stay connected.</p>
<ul class="wdw-bullets list-unstyled text-start mb-4">
<li>Pick up where you left off</li><li>Your saved places are waiting</li><li>Secure, one-tap sign in</li>
</ul>
<button type="button" class="btn btn-outline-light rounded-pill px-4" data-switch="signin">Sign in</button>
</div>
</div>
<p class="visually-hidden" id="auth-live" role="status" aria-live="polite"></p>
</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 { position: relative; min-height: 660px; }
.wdw-auth-panel { position: absolute; top: 0; bottom: 0; width: 100%; display: flex; flex-direction: column; justify-content: center; transition: transform .6s cubic-bezier(.65,0,.35,1), opacity .4s; }
.wdw-auth-signup { opacity: 0; pointer-events: none; visibility: hidden; }
.wdw-auth[data-mode="signup"] .wdw-auth-signup { opacity: 1; pointer-events: auto; visibility: visible; }
.wdw-auth[data-mode="signup"] .wdw-auth-signin { opacity: 0; pointer-events: none; visibility: hidden; }
.wdw-or { display: flex; align-items: center; gap: .75rem; }
.wdw-or::before, .wdw-or::after { content: ""; flex: 1; height: 1px; background: var(--bs-border-color); }
.wdw-auth .btn-link { text-decoration: none; font-weight: 600; }
.wdw-auth .wdw-switch-link { min-height: 44px; padding-inline: .25rem !important; }
.wdw-eye { width: 3rem; padding: 0; }
@media (max-width: 767.98px) {
.wdw-auth { min-height: 760px; }
}
@media (min-width: 768px) {
.wdw-auth-panel { width: 50%; }
.wdw-auth-signup { left: 0; transform: translateX(0); }
.wdw-auth-signin { left: 0; }
.wdw-auth[data-mode="signup"] .wdw-auth-signup { transform: translateX(100%); }
.wdw-auth[data-mode="signup"] .wdw-auth-signin { transform: translateX(100%); }
.wdw-auth-overlay { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; overflow: hidden; z-index: 2; border-radius: 0; transition: transform .6s cubic-bezier(.65,0,.35,1); }
.wdw-auth[data-mode="signup"] .wdw-auth-overlay { transform: translateX(-100%); }
.wdw-auth-copy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2.5rem; color: #fff; transition: opacity .4s, visibility .4s; }
#copy-signup { opacity: 0; pointer-events: none; visibility: hidden; }
.wdw-auth[data-mode="signup"] #copy-signin { opacity: 0; pointer-events: none; visibility: hidden; }
.wdw-auth[data-mode="signup"] #copy-signup { opacity: 1; pointer-events: auto; visibility: visible; }
}
@media (prefers-reduced-motion: reduce) { .wdw-auth-panel, .wdw-auth-overlay, .wdw-auth-copy { transition: none; } }
.wdw-auth .btn-outline-secondary { --bs-btn-hover-color: var(--bs-body-color); }
.wdw-brand-mark { width: 3rem; height: 3rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .9rem; background: rgba(255,255,255,.16); }
.wdw-bullets li { position: relative; padding-left: 1.5rem; margin-bottom: .5rem; font-size: .9rem; }
.wdw-bullets li::before { content: ""; position: absolute; left: 0; top: .45em; width: .6rem; height: .35rem; border-left: 2px solid #c7d2fe; border-bottom: 2px solid #c7d2fe; transform: rotate(-45deg); }
.wdw-eye { --bs-btn-border-color: var(--bs-border-color); --bs-btn-color: var(--bs-secondary-color); }
(function () {
function initAuthSwitch() {
var root = document.getElementById('auth');
if (!root) return;
var live = document.getElementById('auth-live');
var panels = { signin: document.getElementById('panel-signin'), signup: document.getElementById('panel-signup') };
function sync(mode) {
Object.keys(panels).forEach(function (k) {
if (k === mode) panels[k].removeAttribute('inert'); else panels[k].setAttribute('inert', '');
});
}
sync(root.dataset.mode);
root.addEventListener('click', function (e) {
var btn = e.target.closest('[data-switch]');
if (!btn) return;
var mode = btn.dataset.switch;
root.dataset.mode = mode;
sync(mode);
if (live) live.textContent = mode === 'signup' ? 'Create account form shown' : 'Sign in form shown';
var target = document.querySelector(mode === 'signup' ? '#su-name' : '#si-email');
if (target) setTimeout(function () { target.focus({ preventScroll: true }); }, 350);
});
}
function initPasswordToggles() {
document.querySelectorAll('[data-toggle-pass]').forEach(function (btn) {
var input = document.getElementById(btn.dataset.togglePass);
if (!input) return;
btn.addEventListener('click', function () {
var show = input.type === 'password';
input.type = show ? 'text' : 'password';
btn.setAttribute('aria-pressed', String(show));
btn.setAttribute('aria-label', show ? 'Hide password' : 'Show password');
});
});
}
initAuthSwitch();
initPasswordToggles();
})();
<section class="sl-stage">
<div class="sl-card" id="slCard">
<p class="visually-hidden" role="status" id="slStatus"></p>
<div class="sl-panel sl-signup" id="slSignupPanel">
<form class="sl-form" action="#" data-bs-validate novalidate>
<h2 class="fs-2xl">Create account</h2>
<div class="sl-social">
<button class="btn-outline theme-secondary btn-sm" type="button" aria-label="Continue with Google">Google</button>
<button class="btn-outline theme-secondary btn-sm" type="button" aria-label="Continue with GitHub">GitHub</button>
<button class="btn-outline theme-secondary btn-sm" type="button" aria-label="Continue with LinkedIn">LinkedIn</button>
</div>
<p class="sl-or">or use your email for registration</p>
<div class="form-field">
<label class="form-label" for="sl-name">Name</label>
<input class="form-control" type="text" id="sl-name" autocomplete="name" placeholder="Your name" required>
</div>
<div class="form-field">
<label class="form-label" for="sl-email-up">Email</label>
<input class="form-control" type="email" id="sl-email-up" autocomplete="email" placeholder="[email protected]" required>
</div>
<div class="form-field">
<label class="form-label" for="sl-pass-up">Password</label>
<input class="form-control" type="password" id="sl-pass-up" autocomplete="new-password" minlength="8" placeholder="At least 8 characters" required>
</div>
<button class="btn-solid theme-primary btn-lg w-100" type="submit">Sign up</button>
<p class="sl-swap md:d-none">Already registered? <button class="btn-link" type="button" data-sl="signin">Sign in</button></p>
</form>
</div>
<div class="sl-panel sl-signin" id="slSigninPanel">
<form class="sl-form" action="#" data-bs-validate novalidate>
<h2 class="fs-2xl">Sign in</h2>
<div class="sl-social">
<button class="btn-outline theme-secondary btn-sm" type="button" aria-label="Continue with Google">Google</button>
<button class="btn-outline theme-secondary btn-sm" type="button" aria-label="Continue with GitHub">GitHub</button>
<button class="btn-outline theme-secondary btn-sm" type="button" aria-label="Continue with LinkedIn">LinkedIn</button>
</div>
<p class="sl-or">or use your account</p>
<div class="form-field">
<label class="form-label" for="sl-email-in">Email</label>
<input class="form-control" type="email" id="sl-email-in" autocomplete="email" placeholder="[email protected]" required>
</div>
<div class="form-field">
<label class="form-label" for="sl-pass-in">Password</label>
<input class="form-control" type="password" id="sl-pass-in" autocomplete="current-password" placeholder="Your password" required>
</div>
<a class="fs-sm" href="#">Forgot your password?</a>
<button class="btn-solid theme-primary btn-lg w-100" type="submit">Sign in</button>
<p class="sl-swap md:d-none">New here? <button class="btn-link" type="button" data-sl="signup">Create an account</button></p>
</form>
</div>
<div class="sl-overlay">
<div class="sl-overlay-inner">
<img class="sl-overlay-img" src="https://images.unsplash.com/photo-1495616811223-4d98c6e9c869?w=1400&q=80" alt="" width="1400" height="788">
<div class="sl-overlay-panel sl-overlay-left">
<h2 class="fs-2xl">Welcome back!</h2>
<p>To stay connected with us, please sign in with your personal info.</p>
<button class="btn-outline theme-secondary sl-ghost" type="button" data-sl="signin">Sign in</button>
</div>
<div class="sl-overlay-panel sl-overlay-right">
<h2 class="fs-2xl">Hello, friend!</h2>
<p>Enter your personal details and start your journey with us.</p>
<button class="btn-outline theme-secondary sl-ghost" type="button" data-sl="signup">Sign up</button>
</div>
</div>
</div>
</div>
</section>
.sl-stage { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: var(--bs-bg-2); }
.sl-card { position: relative; width: 100%; max-width: 900px; min-height: 560px; overflow: hidden; background: var(--bs-bg-body); border: 1px solid var(--bs-border-color); border-radius: var(--bs-radius-7); box-shadow: 0 24px 60px -30px rgb(0 0 0 / .4); }
.sl-panel { position: absolute; inset: 0; display: none; }
.sl-signin { display: block; }
.sl-card.is-signup .sl-signin { display: none; }
.sl-card.is-signup .sl-signup { display: block; }
.sl-form { display: flex; flex-direction: column; justify-content: center; gap: .875rem; height: 100%; padding: 2rem 1.5rem; overflow-y: auto; }
.sl-form h2 { margin: 0; text-align: center; }
.sl-social { display: flex; justify-content: center; gap: .5rem; }
.sl-or { margin: 0; text-align: center; font-size: .875rem; color: var(--bs-fg-3); }
.sl-swap { margin: 0; text-align: center; font-size: .875rem; color: var(--bs-fg-3); }
.sl-overlay { display: none; }
@media (width >= 768px) {
.sl-panel { display: block; width: 50%; transition: transform .6s ease-in-out, opacity .6s ease-in-out; }
.sl-signin { left: 0; z-index: 2; }
.sl-signup { left: 0; z-index: 1; opacity: 0; pointer-events: none; visibility: hidden; }
.sl-card.is-signup .sl-signin { display: block; transform: translateX(100%); opacity: 0; pointer-events: none; visibility: hidden; }
.sl-card.is-signup .sl-signup { transform: translateX(100%); opacity: 1; z-index: 5; pointer-events: auto; visibility: visible; }
.sl-form { padding: 2rem 3rem; }
.sl-overlay { position: absolute; top: 0; left: 50%; z-index: 10; display: block; width: 50%; height: 100%; overflow: hidden; transition: transform .6s ease-in-out; }
.sl-card.is-signup .sl-overlay { transform: translateX(-100%); }
.sl-overlay-inner { position: relative; left: -100%; width: 200%; height: 100%; transition: transform .6s ease-in-out; isolation: isolate; color: #fff; }
.sl-card.is-signup .sl-overlay-inner { transform: translateX(50%); }
.sl-overlay-img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.sl-overlay-inner::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(135deg, rgb(40 10 60 / .62), rgb(20 10 30 / .5)); }
.sl-overlay-panel { position: absolute; top: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; width: 50%; height: 100%; padding: 0 2.5rem; text-align: center; transition: transform .6s ease-in-out; }
.sl-overlay-panel h2 { margin: 0; color: #fff; }
.sl-overlay-panel p { margin: 0; color: rgb(255 255 255 / .9); }
.sl-overlay-left { transform: translateX(-20%); }
.sl-overlay-right { right: 0; transform: translateX(0); }
.sl-card.is-signup .sl-overlay-left { transform: translateX(0); }
.sl-card.is-signup .sl-overlay-right { transform: translateX(20%); }
.sl-ghost { --bs-btn-color: #fff; color: #fff; border-color: #fff; min-width: 9rem; }
.sl-ghost:hover { color: #1a1a1a; background: #fff; }
}
@media (prefers-reduced-motion: reduce) {
.sl-panel, .sl-overlay, .sl-overlay-inner, .sl-overlay-panel { transition: none; }
}
const initSlidePanels = () => {
const card = document.getElementById('slCard')
if (!card) return
const left = card.querySelector('.sl-overlay-left')
const right = card.querySelector('.sl-overlay-right')
const status = document.getElementById('slStatus')
// Only the overlay panel that is on screen may take focus.
const syncInert = (signup) => {
if (left) left.inert = !signup
if (right) right.inert = signup
}
const show = (mode) => {
const signup = mode === 'signup'
card.classList.toggle('is-signup', signup)
syncInert(signup)
if (status) status.textContent = signup ? 'Sign up form shown' : 'Sign in form shown'
const target = card.querySelector(signup ? '#sl-name' : '#sl-email-in')
if (target && getComputedStyle(target).visibility !== 'hidden') setTimeout(() => target.focus({ preventScroll: true }), 650)
}
syncInert(card.classList.contains('is-signup'))
card.querySelectorAll('[data-sl]').forEach((btn) => {
btn.addEventListener('click', () => show(btn.dataset.sl))
})
}
initSlidePanels()
Built on Bootstrap 6.0.0-alpha.1 (ES modules, no jQuery). Load Bootstrap through an import map and run the JavaScript as type="module" — the downloaded file is already set up that way. Alpha releases can still change class names.
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.