Bootstrap 5 Login Form Examples (3 Styles)
Three login card variations: email and password with remember-me, social sign-in options, and an icon-led secure form with a success message.
<section class="lg-section wdw-stage"><div class="container">
<div class="row g-4 justify-content-center">
<div class="col-md-6 col-lg-4"><div class="card wdw-card border-0 h-100 lg-card overflow-hidden"><form class="card-body d-flex flex-column p-4 p-xl-5" novalidate onsubmit="return false"><div class="d-flex align-items-center gap-3 mb-4"><span class="wdw-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="8" r="4"/><path d="M4 21c.6-4 4-6 8-6s7.400 2 8 6"/></svg></span><div><h2 class="h4 fw-bold mb-0 text-body-emphasis">Sign in</h2><p class="text-body-secondary small mb-0">Welcome back.</p></div></div><div class="mb-3"><div class="form-floating"><input type="email" class="form-control" id="lg1Email" placeholder="Email address" autocomplete="email"><label for="lg1Email">Email address</label></div></div><div class="input-group mb-3"><div class="form-floating"><input type="password" class="form-control" id="lg1Pass" placeholder="Password" autocomplete="current-password"><label for="lg1Pass">Password</label></div><button class="btn lg-eye" type="button" aria-label="Show password" aria-pressed="false" data-pw="#lg1Pass"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3.500-7 10-7 10 7 10 7-3.500 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 mb-4"><div class="form-check"><input class="form-check-input" type="checkbox" id="lg1Remember"><label class="form-check-label small" for="lg1Remember">Remember me</label></div><a href="#" class="small link-primary fw-medium">Forgot password?</a></div><button type="submit" class="btn btn-primary w-100 rounded-pill">Log in</button><div class="lg-or text-body-secondary small my-3"><span>or</span></div><div class="d-grid"><button type="button" class="btn btn-outline-secondary rounded-pill"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="15" r="4"/><path d="M11 12l9-9M16 7l3 3M14 9l2 2"/></svg> Sign in with SSO</button></div><div class="mt-auto"></div><p class="text-center text-body-secondary small mt-4 mb-0">No account? <a href="#" class="link-primary fw-medium">Sign up</a></p></form></div></div>
<div class="col-md-6 col-lg-4"><div class="card wdw-card border-0 h-100 lg-card overflow-hidden"><form class="card-body d-flex flex-column p-4 p-xl-5" novalidate onsubmit="return false"><div class="d-flex align-items-center gap-3 mb-4"><span class="wdw-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3l1.9 5.100L19 10l-5.100 1.900L12 17l-1.900-5.100L5 10l5.100-1.900z"/></svg></span><div><h2 class="h4 fw-bold mb-0 text-body-emphasis">Welcome</h2><p class="text-body-secondary small mb-0">Choose how to continue.</p></div></div><div class="d-grid gap-2"><button type="button" class="btn btn-outline-secondary rounded-pill"><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.4-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> Continue with GitHub</button><button type="button" class="btn btn-outline-secondary rounded-pill"><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="M21 12.200c0-.6-.1-1.200-.2-1.700H12v3.300h5.100a4.400 4.400 0 0 1-1.900 2.900v2.400h3.100c1.800-1.700 2.700-4.100 2.700-6.900z" stroke="none" fill="currentColor"/><path d="M20 4.500A10 10 0 1 0 22 12h-9"/></svg> Continue with Google</button></div><div class="lg-or text-body-secondary small my-3"><span>or</span></div><div class="mb-3"><div class="form-floating"><input type="email" class="form-control" id="lg2Email" placeholder="Email address" autocomplete="email"><label for="lg2Email">Email address</label></div></div><div class="mb-3"><div class="form-floating"><input type="password" class="form-control" id="lg2Pass" placeholder="Password" autocomplete="current-password"><label for="lg2Pass">Password</label></div></div><div class="d-flex justify-content-between align-items-center mb-4"><div class="form-check"><input class="form-check-input" type="checkbox" id="lg2Remember"><label class="form-check-label small" for="lg2Remember">Remember me</label></div><a href="#" class="small link-primary fw-medium">Forgot password?</a></div><div class="mt-auto"></div><button type="submit" class="btn btn-primary w-100 rounded-pill">Log in</button><p class="text-center text-body-secondary small mt-4 mb-0">No account? <a href="#" class="link-primary fw-medium">Sign up</a></p></form></div></div>
<div class="col-md-6 col-lg-4"><div class="card wdw-card border-0 h-100 lg-card overflow-hidden"><div class="wdw-aurora lg-band d-flex align-items-center gap-3 p-4 px-xl-5"><span class="lg-glass" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="3"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></svg></span><div><h2 class="h4 fw-bold mb-0 text-white">Secure sign in</h2><p class="small mb-0 lg-band-sub">Your session is protected.</p></div></div><form class="card-body d-flex flex-column p-4 p-xl-5" novalidate onsubmit="return false"><div class="alert alert-success d-flex align-items-start gap-2 border-0 mb-3" role="status"><svg class="flex-none mt-1" 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"><circle cx="12" cy="12" r="10"/><path d="M8 12.500l2.800 2.800L16 9.500"/></svg><div><strong class="d-block">Password updated</strong><span class="small">Log in with your new password to continue.</span></div></div><div class="mb-3"><div class="form-floating"><input type="email" class="form-control" id="lg3Email" placeholder="Email address" autocomplete="email"><label for="lg3Email">Email address</label></div></div><div class="mb-3"><div class="form-floating"><input type="password" class="form-control" id="lg3Pass" placeholder="Password" autocomplete="current-password"><label for="lg3Pass">Password</label></div></div><div class="d-flex justify-content-between align-items-center mb-4"><div class="form-check"><input class="form-check-input" type="checkbox" id="lg3Remember"><label class="form-check-label small" for="lg3Remember">Remember me</label></div><a href="#" class="small link-primary fw-medium">Forgot password?</a></div><div class="mt-auto"></div><button type="submit" class="btn btn-primary w-100 rounded-pill">Log in</button><p class="text-center text-body-secondary small mt-4 mb-0">No account? <a href="#" class="link-primary fw-medium">Sign up</a></p></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 */
.lg-section .lg-eye { border-radius: 0 .75rem .75rem 0; min-width: 3rem; }
.lg-or { display: flex; align-items: center; gap: .75rem; }
.lg-or::before, .lg-or::after { content: ""; flex: 1; height: 1px; background: var(--bs-border-color); }
.lg-card { position: relative; }
.lg-eye { background: var(--bs-body-bg); color: var(--bs-secondary-color); border: 1px solid var(--bs-border-color); }
.lg-eye:hover { background: var(--bs-tertiary-bg); color: var(--bs-emphasis-color); }
.lg-glass { width: 2.75rem; height: 2.75rem; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: .875rem; background: rgba(255,255,255,.16); color: #fff; }
.lg-band-sub { color: rgba(255,255,255,.82); }
.flex-none { flex: none; }
.lg-card .btn-outline-secondary { --bs-btn-color: var(--bs-emphasis-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-secondary-color); --bs-btn-active-bg: var(--bs-tertiary-bg); --bs-btn-active-color: var(--bs-emphasis-color); font-weight: 500; }
(function () {
function initPasswordToggle() {
document.querySelectorAll('.lg-eye').forEach(function (btn) {
var input = document.querySelector(btn.dataset.pw);
if (!input) return;
btn.addEventListener('click', function () {
var show = input.type === 'password';
input.type = show ? 'text' : 'password';
btn.setAttribute('aria-pressed', show ? 'true' : 'false');
btn.setAttribute('aria-label', show ? 'Hide password' : 'Show password');
});
});
}
initPasswordToggle();
})();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.