Snippets Form

Bootstrap 5 Login Form with Avatar

A centred login card with a profile avatar, floating-label fields, remember-me, forgot-password link and a secondary create-account action.

Bootstrap 5 No jQuery Oct 2020 2.7K views

<section class="wdw-stage">
  <div class="container" style="max-width: 440px;">
    <div class="wdw-card overflow-hidden">
      <div class="wdw-aurora login-band"></div>
      <div class="px-4 px-md-5 pb-4 pb-md-5">
        <div class="text-center mb-4 login-head">
          <span class="login-avatar-wrap mb-2">
            <img class="login-avatar" src="https://i.pravatar.cc/200?img=47" alt="Profile picture of Maya" width="96" height="96">
            <span class="login-online" role="img" aria-label="Online"></span>
          </span>
          <h1 class="h3 wdw-heading mb-1">Welcome back, Maya</h1>
          <p class="wdw-muted mb-0">Sign in to continue to your dashboard. <a href="#" class="fw-semibold">Not you?</a></p>
        </div>
        <form class="d-grid gap-3" id="loginForm" novalidate>
          <div class="form-floating">
            <input type="email" class="form-control" id="loginEmail" placeholder="Email address" autocomplete="email" value="[email protected]" required>
            <label for="loginEmail">Email address</label>
            <div class="invalid-feedback">Enter a valid email address.</div>
          </div>
          <div class="input-group has-validation">
            <div class="form-floating">
              <input type="password" class="form-control" id="loginPass" placeholder="Password" autocomplete="current-password" required>
              <label for="loginPass">Password</label>
              <div class="invalid-feedback">Password is required.</div>
            </div>
            <button type="button" class="btn btn-outline-secondary px-3" 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>
          <div class="d-flex justify-content-between align-items-center">
            <div class="form-check mb-0">
              <input class="form-check-input" type="checkbox" id="loginRemember">
              <label class="form-check-label small" for="loginRemember">Remember me</label>
            </div>
            <a href="#" class="small fw-semibold">Forgot password?</a>
          </div>
          <button type="submit" class="btn btn-primary rounded-pill" id="loginSubmit">Log in</button>
          <div class="d-flex align-items-center gap-3 wdw-muted small"><hr class="flex-grow-1 m-0" role="presentation" aria-hidden="true"><span aria-hidden="true">or</span><hr class="flex-grow-1 m-0" role="presentation" aria-hidden="true"></div>
          <button type="button" class="btn btn-outline-primary rounded-pill d-flex align-items-center justify-content-center gap-2">
            <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"><circle cx="8" cy="15" r="4"/><path d="M10.8 12.2 21 2M17 6l3 3M14 9l2 2"/></svg>
            Sign in with a passkey
          </button>
          <p class="text-center small wdw-muted mb-0">New here? <a href="#" class="fw-semibold">Create an account</a></p>
        </form>
      </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.