Snippets Animation

Bootstrap 5 Animated Login and Registration Form

A split login and registration card where a side panel slides the panels apart to switch between the two forms.

Bootstrap 5 No jQuery Oct 2020 2.9K views

<section class="wdw-stage">
  <div class="container" style="max-width:960px">
    <div class="wdw-card overflow-hidden auth" id="auth" data-mode="login">
      <div class="auth-stage">
        <div class="auth-panel wdw-aurora d-flex flex-column justify-content-center p-4 p-lg-5 text-center text-md-start">
          <div class="auth-copy auth-copy-login">
            <h2 class="fw-bold mb-2">New here?</h2>
            <p class="opacity-75 mb-4">Create an account in under a minute and get started right away.</p>
            <button type="button" class="btn btn-outline-light rounded-pill px-4" data-auth-switch="register">Register</button>
          </div>
          <div class="auth-copy auth-copy-register">
            <h2 class="fw-bold mb-2">Welcome back</h2>
            <p class="opacity-75 mb-4">Already have an account? Sign in to continue where you left off.</p>
            <button type="button" class="btn btn-outline-light rounded-pill px-4" data-auth-switch="login">Log in</button>
          </div>
        </div>
        <div class="auth-formcol p-4 p-lg-5">
          <div class="nav nav-pills rounded-pill bg-body-tertiary p-1 mb-4 auth-seg" role="group" aria-label="Choose login or register">
            <button type="button" class="nav-link rounded-pill flex-fill active" data-auth-switch="login" aria-pressed="true">Log in</button>
            <button type="button" class="nav-link rounded-pill flex-fill" data-auth-switch="register" aria-pressed="false">Register</button>
          </div>
          <div class="auth-forms">
            <form class="auth-form auth-form-login" id="loginF" novalidate>
              <h3 class="wdw-heading h3 mb-1">Log in</h3>
              <p class="wdw-muted mb-3">Enter your details to access your account.</p>
              <div class="d-grid gap-2 d-sm-flex mb-3">
                <button type="button" class="btn btn-outline-secondary rounded-pill flex-fill"><svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true"><path fill="#4285F4" d="M22.5 12.2c0-.8-.1-1.5-.2-2.2H12v4.2h5.9a5 5 0 0 1-2.2 3.3v2.7h3.5c2-1.9 3.3-4.700 3.3-8z"/><path fill="#34A853" d="M12 23c3 0 5.400-1 7.200-2.700l-3.500-2.700c-1 .7-2.200 1-3.700 1-2.800 0-5.200-1.900-6-4.500H2.400v2.800A11 11 0 0 0 12 23z"/><path fill="#FBBC05" d="M6 14.100a6.600 6.600 0 0 1 0-4.200V7.100H2.400a11 11 0 0 0 0 9.800z"/><path fill="#EA4335" d="M12 5.400c1.600 0 3 .6 4.200 1.600l3.100-3.100A11 11 0 0 0 2.400 7.100L6 9.900c.8-2.600 3.200-4.500 6-4.500z"/></svg>Google</button>
                <button type="button" class="btn btn-outline-secondary rounded-pill flex-fill"><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.100-.7.100-.7 1.200.1 1.800 1.200 1.800 1.200 1 1.800 2.700 1.300 3.400 1 .1-.8.400-1.300.7-1.600-2.600-.3-5.200-1.300-5.200-5.700 0-1.300.4-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.7.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.300c0 .3.200.7.800.6A11.500 11.500 0 0 0 12 .5z"/></svg>GitHub</button>
              </div>
              <div class="d-flex align-items-center gap-3 mb-3 small wdw-muted"><hr class="flex-grow-1 m-0"><span>or continue with email</span><hr class="flex-grow-1 m-0"></div>
              <div class="form-floating mb-3"><input type="email" class="form-control" id="alEmail" placeholder="Email" autocomplete="email" aria-describedby="alEmailErr" required><label for="alEmail">Email address</label><div class="invalid-feedback" id="alEmailErr">Enter a valid email address.</div></div>
              <div class="form-floating mb-3 position-relative"><input type="password" class="form-control pe-5" id="alPass" placeholder="Password" autocomplete="current-password" aria-describedby="alPassErr" required><label for="alPass">Password</label><button type="button" class="btn btn-link position-absolute top-0 end-0 mt-2 me-2 p-0 au-eye" data-pw-toggle="alPass" aria-controls="alPass" aria-pressed="false" aria-label="Show password"><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="M1 12s4-8 11-8 11 8 11 8-4 8-11 8S1 12 1 12z"/><circle cx="12" cy="12" r="3"/></svg></button><div class="invalid-feedback" id="alPassErr">Enter your password.</div></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="alRem"><label class="form-check-label" for="alRem">Remember me</label></div>
                <a href="#" class="small link-primary text-decoration-none fw-semibold">Forgot?</a>
              </div>
              <button type="submit" class="btn btn-primary rounded-pill w-100">Log in</button>
            </form>
            <form class="auth-form auth-form-register" id="registerF" novalidate aria-hidden="true">
              <h3 class="wdw-heading h3 mb-1">Create account</h3>
              <p class="wdw-muted mb-3">It only takes a minute.</p>
              <div class="d-grid gap-2 d-sm-flex mb-3">
                <button type="button" class="btn btn-outline-secondary rounded-pill flex-fill"><svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true"><path fill="#4285F4" d="M22.5 12.2c0-.8-.1-1.5-.2-2.2H12v4.2h5.9a5 5 0 0 1-2.2 3.3v2.7h3.5c2-1.9 3.3-4.700 3.3-8z"/><path fill="#34A853" d="M12 23c3 0 5.400-1 7.200-2.700l-3.500-2.700c-1 .7-2.200 1-3.700 1-2.800 0-5.200-1.900-6-4.500H2.400v2.800A11 11 0 0 0 12 23z"/><path fill="#FBBC05" d="M6 14.100a6.600 6.600 0 0 1 0-4.200V7.100H2.400a11 11 0 0 0 0 9.800z"/><path fill="#EA4335" d="M12 5.400c1.600 0 3 .6 4.200 1.600l3.100-3.100A11 11 0 0 0 2.400 7.100L6 9.900c.8-2.600 3.200-4.500 6-4.500z"/></svg>Google</button>
                <button type="button" class="btn btn-outline-secondary rounded-pill flex-fill"><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.100-.7.100-.7 1.200.1 1.800 1.200 1.800 1.200 1 1.800 2.700 1.300 3.400 1 .1-.8.400-1.300.7-1.600-2.600-.3-5.200-1.300-5.200-5.700 0-1.300.4-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.7.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.300c0 .3.200.7.800.6A11.500 11.500 0 0 0 12 .5z"/></svg>GitHub</button>
              </div>
              <div class="d-flex align-items-center gap-3 mb-3 small wdw-muted"><hr class="flex-grow-1 m-0"><span>or sign up with email</span><hr class="flex-grow-1 m-0"></div>
              <div class="form-floating mb-3"><input type="text" class="form-control" id="arName" placeholder="Name" autocomplete="name" aria-describedby="arNameErr" required tabindex="-1"><label for="arName">Full name</label><div class="invalid-feedback" id="arNameErr">Enter your name.</div></div>
              <div class="form-floating mb-3"><input type="email" class="form-control" id="arEmail" placeholder="Email" autocomplete="email" aria-describedby="arEmailErr" required tabindex="-1"><label for="arEmail">Email address</label><div class="invalid-feedback" id="arEmailErr">Enter a valid email address.</div></div>
              <div class="form-floating mb-3 position-relative"><input type="password" class="form-control pe-5" id="arPass" placeholder="Password" autocomplete="new-password" minlength="8" aria-describedby="arPassErr" required tabindex="-1"><label for="arPass">Password (8+ characters)</label><button type="button" class="btn btn-link position-absolute top-0 end-0 mt-2 me-2 p-0 au-eye" data-pw-toggle="arPass" aria-controls="arPass" aria-pressed="false" aria-label="Show password"><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="M1 12s4-8 11-8 11 8 11 8-4 8-11 8S1 12 1 12z"/><circle cx="12" cy="12" r="3"/></svg></button><div class="invalid-feedback" id="arPassErr">Use at least 8 characters.</div></div>
              <div class="form-check mb-3"><input class="form-check-input" type="checkbox" id="arTerms" aria-describedby="arTermsErr" required tabindex="-1"><label class="form-check-label small" for="arTerms">I agree to the <a href="#" class="link-primary fw-semibold text-decoration-none">Terms</a> and <a href="#" class="link-primary fw-semibold text-decoration-none">Privacy Policy</a></label><div class="invalid-feedback" id="arTermsErr">Please accept the terms to continue.</div></div>
              <button type="submit" class="btn btn-primary rounded-pill w-100" tabindex="-1">Create account</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.