Snippets Form

Bootstrap 5 Login Form with Show Password Toggle

A clean login card with floating labels, a show-password toggle, remember-me and forgot-password links beside a testimonial panel.

Bootstrap 5 No jQuery May 2019 3.7K views

<section class="wdw-stage">
  <div class="container" style="max-width: 960px">
    <div class="wdw-card overflow-hidden">
      <div class="row g-0">
        <div class="col-lg-6 p-4 p-md-5 order-2 order-lg-1">
          <div class="mx-auto" style="max-width: 360px">
            <span class="wdw-icon mb-3"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg></span>
            <h1 class="h3 wdw-heading mb-1">Welcome back</h1>
            <p class="wdw-muted mb-4">Log in to continue to your dashboard.</p>

            <form id="loginForm" novalidate>
              <div class="form-floating mb-3">
                <input type="text" class="form-control" id="loginUser" placeholder="Username" required autocomplete="username">
                <label for="loginUser">Username</label>
                <div class="invalid-feedback">Enter your username.</div>
              </div>
              <div class="form-floating mb-3 position-relative">
                <input type="password" class="form-control pe-5" id="loginPass" placeholder="Password" required autocomplete="current-password">
                <label for="loginPass">Password</label>
                <button type="button" class="btn btn-link login-eye text-body-secondary" id="loginToggle" aria-label="Show password" aria-pressed="false">
                  <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="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12Z"/><circle cx="12" cy="12" r="3"/></svg>
                </button>
                <div class="invalid-feedback">Enter your password.</div>
              </div>
              <div class="d-flex justify-content-between align-items-center mb-4">
                <div class="form-check mb-0">
                  <input class="form-check-input" type="checkbox" id="loginRemember">
                  <label class="form-check-label" for="loginRemember">Remember me</label>
                </div>
                <a href="#" class="link-primary link-underline-opacity-0 link-underline-opacity-100-hover small fw-semibold">Forgot password?</a>
              </div>
              <button type="submit" class="btn btn-primary rounded-pill w-100">Log in</button>
              <p id="loginStatus" class="small text-center mt-3 mb-0" role="status" aria-live="polite"></p>
            </form>
            <p class="text-center small wdw-muted mt-4 mb-0">New here? <a href="#" class="link-primary fw-semibold link-underline-opacity-0 link-underline-opacity-100-hover">Create an account</a></p>
          </div>
        </div>
        <div class="col-lg-6 order-1 order-lg-2 wdw-aurora p-4 p-md-5 d-flex flex-column justify-content-end login-side">
          <p class="fs-4 fw-semibold lh-sm mb-3">“Everything our team needs is one login away.”</p>
          <div class="d-flex align-items-center gap-3">
            <img src="https://i.pravatar.cc/96?img=32" width="44" height="44" class="rounded-circle border border-2 border-white border-opacity-50" alt="Portrait of Daniel Reyes">
            <div class="small"><strong class="d-block">Daniel Reyes</strong><span class="opacity-75">Operations lead</span></div>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.

Free to use in personal and commercial projects under the MIT license.