Snippets Form

Bootstrap 5 Sliding Sign In / Sign Up Form

A sign-in and sign-up card where a gradient panel slides across to switch between the two forms, collapsing to a simple text-link toggle on small screens.

Bootstrap 5 No jQuery Nov 2020 11K views

<section class="wdw-stage">
  <div class="container sw-wrap">
    <div class="sw card wdw-card overflow-hidden" id="sw" data-mode="signin">
      <!-- Sign in -->
      <div class="sw-pane sw-pane-in p-4 p-md-5" id="sw-in">
        <div class="sw-seg d-md-none nav nav-pills sw-track rounded-pill p-1 mb-4" role="group" aria-label="Choose form">
          <button type="button" class="nav-link rounded-pill flex-fill active" data-sw-go="signin" aria-pressed="true">Sign in</button>
          <button type="button" class="nav-link rounded-pill flex-fill " data-sw-go="signup" aria-pressed="false">Sign up</button>
        </div>
        <form class="sw-form" novalidate>
          <h1 class="h3 wdw-heading mb-1">Welcome back</h1>
          <p class="text-body-secondary mb-4">Sign in to continue to your dashboard.</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 d-flex align-items-center justify-content-center gap-2"><svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true"><path fill="#4285F4" d="M23 12.3c0-.8-.1-1.500-.2-2.200H12v4.200h6.200a5.300 5.300 0 0 1-2.300 3.500v2.900h3.700c2.200-2 3.400-5 3.400-8.400z"/><path fill="#34A853" d="M12 24c3.100 0 5.700-1 7.600-2.800l-3.700-2.900c-1 .7-2.300 1.100-3.900 1.100-3 0-5.500-2-6.400-4.700H1.800v3A12 12 0 0 0 12 24z"/><path fill="#FBBC05" d="M5.600 14.700a7.200 7.200 0 0 1 0-4.600v-3H1.800a12 12 0 0 0 0 10.600z"/><path fill="#EA4335" d="M12 4.800c1.700 0 3.200.6 4.400 1.700l3.300-3.300A12 12 0 0 0 1.800 7.100l3.800 3C6.500 6.800 9 4.800 12 4.800z"/></svg>Google</button></div><div class="col-6"><button type="button" class="btn btn-outline-secondary text-body rounded-pill w-100 d-flex align-items-center justify-content-center gap-2"><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-.2.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.1-.7.1-.7 1.200.1 1.800 1.200 1.800 1.200 1 1.800 2.700 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 .4.200.7.800.6A11.500 11.500 0 0 0 12 .5z"/></svg>GitHub</button></div></div><div class="d-flex align-items-center gap-3 text-body-secondary small mb-3"><hr class="flex-grow-1 m-0"><span>or with email</span><hr class="flex-grow-1 m-0"></div>
          <div class="sw-field position-relative mb-3"><svg class="sw-ico" 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"><rect x="3" y="5" width="18" height="14" rx="3"/><path d="M3 8l9 6 9-6"/></svg><div class="form-floating"><input type="email" class="form-control" id="sw-in-email" placeholder="Email" autocomplete="email" required><label for="sw-in-email">Email</label></div></div>
          <div class="sw-field position-relative mb-1"><svg class="sw-ico" 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"><rect x="4" y="10" width="16" height="11" rx="3"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/></svg><div class="form-floating"><input type="password" class="form-control" id="sw-in-pass" placeholder="Password" autocomplete="current-password" required><label for="sw-in-pass">Password</label></div><button type="button" class="sw-eye" data-sw-eye aria-label="Show password" aria-pressed="false"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" 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-3"><div class="form-check mb-0"><input class="form-check-input" type="checkbox" id="sw-keep"><label class="form-check-label small" for="sw-keep">Keep me signed in</label></div><a href="#" class="sw-forgot">Forgot password?</a></div>
          <button type="submit" class="btn btn-primary w-100 rounded-pill">Sign in</button>
        </form>
      </div>
      <!-- Sign up -->
      <div class="sw-pane sw-pane-up p-4 p-md-5" id="sw-up">
        <div class="sw-seg d-md-none nav nav-pills sw-track rounded-pill p-1 mb-4" role="group" aria-label="Choose form">
          <button type="button" class="nav-link rounded-pill flex-fill " data-sw-go="signin" aria-pressed="false">Sign in</button>
          <button type="button" class="nav-link rounded-pill flex-fill active" data-sw-go="signup" aria-pressed="true">Sign up</button>
        </div>
        <form class="sw-form" novalidate>
          <h1 class="h3 wdw-heading mb-1">Create account</h1>
          <p class="text-body-secondary mb-4">It takes less than a minute.</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 d-flex align-items-center justify-content-center gap-2"><svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true"><path fill="#4285F4" d="M23 12.3c0-.8-.1-1.500-.2-2.200H12v4.200h6.200a5.300 5.300 0 0 1-2.300 3.500v2.900h3.700c2.200-2 3.400-5 3.400-8.400z"/><path fill="#34A853" d="M12 24c3.100 0 5.700-1 7.600-2.800l-3.700-2.900c-1 .7-2.300 1.100-3.900 1.100-3 0-5.500-2-6.400-4.700H1.800v3A12 12 0 0 0 12 24z"/><path fill="#FBBC05" d="M5.600 14.700a7.200 7.200 0 0 1 0-4.600v-3H1.800a12 12 0 0 0 0 10.600z"/><path fill="#EA4335" d="M12 4.800c1.700 0 3.200.6 4.400 1.700l3.300-3.300A12 12 0 0 0 1.800 7.100l3.800 3C6.500 6.800 9 4.800 12 4.800z"/></svg>Google</button></div><div class="col-6"><button type="button" class="btn btn-outline-secondary text-body rounded-pill w-100 d-flex align-items-center justify-content-center gap-2"><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-.2.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.1-.7.1-.7 1.200.1 1.800 1.200 1.800 1.200 1 1.800 2.700 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 .4.200.7.800.6A11.500 11.500 0 0 0 12 .5z"/></svg>GitHub</button></div></div><div class="d-flex align-items-center gap-3 text-body-secondary small mb-3"><hr class="flex-grow-1 m-0"><span>or with email</span><hr class="flex-grow-1 m-0"></div>
          <div class="sw-field position-relative mb-3"><svg class="sw-ico" 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="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/></svg><div class="form-floating"><input type="text" class="form-control" id="sw-up-name" placeholder="Full name" autocomplete="name" required><label for="sw-up-name">Full name</label></div></div>
          <div class="sw-field position-relative mb-3"><svg class="sw-ico" 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"><rect x="3" y="5" width="18" height="14" rx="3"/><path d="M3 8l9 6 9-6"/></svg><div class="form-floating"><input type="email" class="form-control" id="sw-up-email" placeholder="Email" autocomplete="email" required><label for="sw-up-email">Email</label></div></div>
          <div class="sw-field position-relative mb-4"><svg class="sw-ico" 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"><rect x="4" y="10" width="16" height="11" rx="3"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/></svg><div class="form-floating"><input type="password" class="form-control" id="sw-up-pass" placeholder="Password" autocomplete="new-password" required><label for="sw-up-pass">Password</label></div><button type="button" class="sw-eye" data-sw-eye aria-label="Show password" aria-pressed="false"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" 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>
          <button type="submit" class="btn btn-primary w-100 rounded-pill">Sign up</button>
        </form>
      </div>
      <!-- Sliding brand panel (desktop) -->
      <div class="sw-overlay wdw-aurora d-none d-md-flex text-white">
        <div class="sw-ov sw-ov-to-up">
          <div class="d-flex align-items-center gap-2 fw-semibold mb-4"><span class="sw-logo" aria-hidden="true"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4 18 10 6l4 8 2-4 4 8"/></svg></span>Harbor</div>
          <h2 class="h2 fw-bold mb-3">Plan, track and ship together.</h2>
          <div class="sw-mock mb-4" aria-hidden="true"><div class="d-flex justify-content-between small mb-2"><span>Weekly activity</span><span class="fw-semibold">+24%</span></div><div class="sw-bars"><i style="height:38%"></i><i style="height:55%"></i><i style="height:42%"></i><i style="height:70%"></i><i style="height:60%"></i><i style="height:88%"></i><i style="height:76%"></i></div></div>
          <p class="small opacity-75 mb-2">New here?</p>
          <button type="button" class="btn btn-light rounded-pill px-4 align-self-start" data-sw-go="signup">Create an account</button>
        </div>
        <div class="sw-ov sw-ov-to-in">
          <div class="d-flex align-items-center gap-2 fw-semibold mb-4"><span class="sw-logo" aria-hidden="true"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4 18 10 6l4 8 2-4 4 8"/></svg></span>Harbor</div>
          <h2 class="h2 fw-bold mb-3">Your workspace is waiting.</h2>
          <div class="sw-mock mb-4" aria-hidden="true"><div class="small mb-1 opacity-75">Open tasks</div><div class="sw-big">18 <span class="small fw-normal opacity-75">due this week</span></div><div class="progress sw-mp mt-2"><div class="progress-bar bg-white" style="width:64%"></div></div></div>
          <p class="small opacity-75 mb-2">Already a member?</p>
          <button type="button" class="btn btn-light rounded-pill px-4 align-self-start" data-sw-go="signin">Sign in</button>
        </div>
      </div>
      <p class="visually-hidden" role="status" id="sw-status">Sign in form shown</p>
    </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.