Snippets Login

Bootstrap 5 Sign In / Sign Up Card with Tabs

A glass-style authentication card over a city photograph with a pill tab switcher between sign in and sign up, floating labels and a remember-me option.

Bootstrap 5 No jQuery May 2019 4.1K views

<section class="wdw-stage position-relative overflow-hidden">
  <img class="sa-bg" src="https://images.unsplash.com/photo-1449824913935-59a10b8d2000?auto=format&fit=crop&w=1600&q=70" alt="">
  <div class="sa-scrim"></div>
  <div class="container position-relative" style="max-width:480px">
    <div class="sa-card rounded-5 overflow-hidden text-white" data-bs-theme="dark">
      <div class="p-4 p-md-5">
        <ul class="nav nav-pills sa-tabs mb-4 p-1 rounded-pill" id="saTabs" role="tablist">
          <li class="nav-item flex-fill" role="presentation"><button class="nav-link rounded-pill w-100 active" id="sa-in-tab" data-bs-toggle="pill" data-bs-target="#sa-in" type="button" role="tab" aria-controls="sa-in" aria-selected="true">Sign in</button></li>
          <li class="nav-item flex-fill" role="presentation"><button class="nav-link rounded-pill w-100" id="sa-up-tab" data-bs-toggle="pill" data-bs-target="#sa-up" type="button" role="tab" aria-controls="sa-up" aria-selected="false">Sign up</button></li>
        </ul>
        <div class="tab-content">
          <div class="tab-pane fade show active" id="sa-in" role="tabpanel" aria-labelledby="sa-in-tab" tabindex="0">
            <h1 class="h3 fw-bold mb-1">Welcome back</h1>
            <p class="small opacity-75 mb-4">Sign in to pick up where you left off.</p>
            <form onsubmit="return false">
              <div class="d-flex gap-2 mb-3"><button type="button" class="btn btn-outline-light rounded-pill flex-fill"><svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true"><path fill="#4285F4" d="M23.5 12.27c0-.85-.08-1.67-.22-2.45H12v4.64h6.45a5.51 5.51 0 0 1-2.39 3.62v3h3.87c2.27-2.09 3.57-5.17 3.57-8.81z"/><path fill="#34A853" d="M12 24c3.24 0 5.95-1.07 7.93-2.91l-3.87-3c-1.07.72-2.45 1.15-4.06 1.15-3.12 0-5.77-2.11-6.71-4.94H1.29v3.09A12 12 0 0 0 12 24z"/><path fill="#FBBC05" d="M5.29 14.3A7.2 7.2 0 0 1 4.91 12c0-.8.14-1.57.38-2.3V6.61H1.29A12 12 0 0 0 0 12c0 1.94.46 3.77 1.29 5.39l4-3.09z"/><path fill="#EA4335" d="M12 4.75c1.76 0 3.34.61 4.59 1.8l3.43-3.43C17.95 1.19 15.24 0 12 0A12 12 0 0 0 1.29 6.61l4 3.09C6.23 6.86 8.88 4.75 12 4.75z"/></svg> Google</button><button type="button" class="btn btn-outline-light rounded-pill flex-fill"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .5a11.5 11.5 0 0 0-3.64 22.41c.58.1.79-.25.79-.56v-2c-3.2.7-3.88-1.37-3.88-1.37-.52-1.33-1.28-1.69-1.28-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.03 1.76 2.69 1.25 3.35.96.1-.74.4-1.25.73-1.54-2.55-.29-5.24-1.28-5.24-5.69 0-1.26.45-2.28 1.18-3.09-.12-.29-.51-1.46.11-3.05 0 0 .97-.31 3.17 1.18a11 11 0 0 1 5.78 0c2.2-1.49 3.17-1.18 3.17-1.18.62 1.59.23 2.76.11 3.05.74.81 1.18 1.83 1.18 3.09 0 4.42-2.69 5.39-5.25 5.68.41.36.78 1.06.78 2.14v3.17c0 .31.21.67.8.56A11.5 11.5 0 0 0 12 .5z"/></svg> GitHub</button></div><div class="d-flex align-items-center gap-2 small opacity-75 mb-3"><hr class="flex-fill m-0"><span>or</span><hr class="flex-fill m-0"></div>
              <div class="form-floating mb-3"><input type="text" class="form-control" id="sa-i-user" placeholder="Username" required autocomplete="username"><label for="sa-i-user">Username</label></div>
              <div class="input-group mb-3 sa-pw"><div class="form-floating"><input type="password" class="form-control" id="sa-i-pass" placeholder="Password" required autocomplete="current-password"><label for="sa-i-pass">Password</label></div><button class="btn btn-outline-light" type="button" data-sa-reveal="sa-i-pass" aria-label="Show password" aria-pressed="false">Show</button></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="sa-keep" checked><label class="form-check-label small" for="sa-keep">Keep me signed in</label></div>
                <a href="#" class="small text-white text-decoration-none fw-semibold">Forgot password?</a>
              </div>
              <button class="btn btn-primary rounded-pill w-100" type="submit">Sign in</button>
            </form>
          </div>
          <div class="tab-pane fade" id="sa-up" role="tabpanel" aria-labelledby="sa-up-tab" tabindex="0">
            <h2 class="h3 fw-bold mb-1">Create your account</h2>
            <p class="small opacity-75 mb-4">Join in seconds. No credit card needed.</p>
            <form onsubmit="return false">
              <div class="d-flex gap-2 mb-3"><button type="button" class="btn btn-outline-light rounded-pill flex-fill"><svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true"><path fill="#4285F4" d="M23.5 12.27c0-.85-.08-1.67-.22-2.45H12v4.64h6.45a5.51 5.51 0 0 1-2.39 3.62v3h3.87c2.27-2.09 3.57-5.17 3.57-8.81z"/><path fill="#34A853" d="M12 24c3.24 0 5.95-1.07 7.93-2.91l-3.87-3c-1.07.72-2.45 1.15-4.06 1.15-3.12 0-5.77-2.11-6.71-4.94H1.29v3.09A12 12 0 0 0 12 24z"/><path fill="#FBBC05" d="M5.29 14.3A7.2 7.2 0 0 1 4.91 12c0-.8.14-1.57.38-2.3V6.61H1.29A12 12 0 0 0 0 12c0 1.94.46 3.77 1.29 5.39l4-3.09z"/><path fill="#EA4335" d="M12 4.75c1.76 0 3.34.61 4.59 1.8l3.43-3.43C17.95 1.19 15.24 0 12 0A12 12 0 0 0 1.29 6.61l4 3.09C6.23 6.86 8.88 4.75 12 4.75z"/></svg> Google</button><button type="button" class="btn btn-outline-light rounded-pill flex-fill"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .5a11.5 11.5 0 0 0-3.64 22.41c.58.1.79-.25.79-.56v-2c-3.2.7-3.88-1.37-3.88-1.37-.52-1.33-1.28-1.69-1.28-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.03 1.76 2.69 1.25 3.35.96.1-.74.4-1.25.73-1.54-2.55-.29-5.24-1.28-5.24-5.69 0-1.26.45-2.28 1.18-3.09-.12-.29-.51-1.46.11-3.05 0 0 .97-.31 3.17 1.18a11 11 0 0 1 5.78 0c2.2-1.49 3.17-1.18 3.17-1.18.62 1.59.23 2.76.11 3.05.74.81 1.18 1.83 1.18 3.09 0 4.42-2.69 5.39-5.25 5.68.41.36.78 1.06.78 2.14v3.17c0 .31.21.67.8.56A11.5 11.5 0 0 0 12 .5z"/></svg> GitHub</button></div><div class="d-flex align-items-center gap-2 small opacity-75 mb-3"><hr class="flex-fill m-0"><span>or</span><hr class="flex-fill m-0"></div>
              <div class="form-floating mb-3"><input type="text" class="form-control" id="sa-u-user" placeholder="Username" required autocomplete="username"><label for="sa-u-user">Username</label></div>
              <div class="form-floating mb-3"><input type="email" class="form-control" id="sa-u-mail" placeholder="Email" required autocomplete="email"><label for="sa-u-mail">Email</label></div>
              <div class="input-group mb-3 sa-pw"><div class="form-floating"><input type="password" class="form-control" id="sa-u-pass" placeholder="Password" required autocomplete="new-password" minlength="8"><label for="sa-u-pass">Password</label></div><button class="btn btn-outline-light" type="button" data-sa-reveal="sa-u-pass" aria-label="Show password" aria-pressed="false">Show</button></div>
              <button class="btn btn-primary rounded-pill w-100 mt-2" type="submit">Sign up</button>
            </form>
          </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.