Snippets Form

Bootstrap 5 Signup Form with Icons and Password Strength

A modern sign-up form with icon-led fields, a show/hide password toggle, a live strength meter and inline validation.

Bootstrap 5 No jQuery Sep 2020 2.4K views

<section class="wdw-stage">
  <div class="container" style="max-width:700px">
    <div class="wdw-card p-4 px-sm-5 py-sm-4">
      <div class="text-center mb-4"><!-- header -->
        <span class="wdw-icon mb-3" aria-hidden="true"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M19 8v6M22 11h-6"/></svg></span>
        <h1 class="wdw-heading h3 mb-1">Create your account</h1>
        <p class="wdw-muted mb-0">Free forever. Takes less than 30 seconds.</p>
      </div>
      <div class="row g-2 mb-3">
        <div class="col-sm-6"><button type="button" class="btn btn-outline-secondary rounded-pill w-100 d-inline-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="M21.6 12.2c0-.7-.1-1.4-.2-2H12v3.8h5.4a4.6 4.6 0 0 1-2 3v2.5h3.2c1.9-1.7 3-4.3 3-7.3z"/><path fill="#34A853" d="M12 22c2.7 0 5-.9 6.6-2.4l-3.2-2.5c-.9.6-2 1-3.4 1-2.6 0-4.800-1.700-5.600-4.100H3.100v2.600A10 10 0 0 0 12 22z"/><path fill="#FBBC05" d="M6.400 13.900a6 6 0 0 1 0-3.800V7.500H3.100a10 10 0 0 0 0 9z"/><path fill="#EA4335" d="M12 6c1.500 0 2.800.5 3.800 1.500l2.800-2.800A10 10 0 0 0 3.100 7.500l3.300 2.600C7.200 7.700 9.400 6 12 6z"/></svg>Google</button></div>
        <div class="col-sm-6"><button type="button" class="btn btn-outline-secondary rounded-pill w-100 d-inline-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 2a10 10 0 0 0-3.200 19.500c.5.1.7-.2.7-.5v-1.700c-2.800.6-3.400-1.300-3.400-1.300-.5-1.100-1.100-1.400-1.100-1.400-.9-.6.1-.6.1-.6 1 .1 1.500 1 1.500 1 .9 1.500 2.300 1.100 2.900.8.1-.6.3-1.100.6-1.300-2.200-.3-4.600-1.100-4.600-5 0-1.100.4-2 1-2.700-.1-.3-.4-1.300.1-2.700 0 0 .8-.3 2.800 1a9.600 9.600 0 0 1 5 0c1.900-1.300 2.800-1 2.800-1 .5 1.400.2 2.400.1 2.700.7.700 1 1.600 1 2.700 0 3.900-2.400 4.700-4.600 5 .4.300.7.900.7 1.800v2.700c0 .3.2.6.7.5A10 10 0 0 0 12 2z"/></svg>GitHub</button></div>
      </div>
      <div class="d-flex align-items-center gap-3 mb-3 wdw-muted small"><hr class="flex-grow-1 m-0"><span>or sign up with email</span><hr class="flex-grow-1 m-0"></div>
      <form class="signup-form row g-3" novalidate>
        <div class="col-sm-6">
          <label for="su-name" class="form-label small fw-semibold">Username</label>
          <div class="input-group">
            <span class="input-group-text" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/></svg></span>
            <input type="text" id="su-name" class="form-control" placeholder="jane.doe" autocomplete="username" required minlength="3">
            </div>
            <div class="invalid-feedback">Use at least 3 characters.</div>
        </div>
        <div class="col-sm-6">
          <label for="su-email" class="form-label small fw-semibold">Email address</label>
          <div class="input-group">
            <span class="input-group-text" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/></svg></span>
            <input type="email" id="su-email" class="form-control" placeholder="[email protected]" autocomplete="email" required>
            </div>
            <div class="invalid-feedback">Enter a valid email address.</div>
        </div>
        <div class="col-sm-6">
          <label for="su-pass" class="form-label small fw-semibold">Password</label>
          <div class="input-group">
            <span class="input-group-text" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg></span>
            <input type="password" id="su-pass" class="form-control" placeholder="8+ characters" autocomplete="new-password" required minlength="8">
            <button type="button" class="btn su-toggle" aria-label="Show password" aria-pressed="false"><svg class="eye-on" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg><svg class="eye-off d-none" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17.9 17.9A10.1 10.1 0 0 1 12 19c-6.5 0-10-7-10-7a17.6 17.6 0 0 1 4.1-4.9M9.9 5.2A9.7 9.7 0 0 1 12 5c6.5 0 10 7 10 7a17.7 17.7 0 0 1-2.2 3.2M1 1l22 22"/></svg></button>
            </div>
            <div class="invalid-feedback">Use at least 8 characters.</div>
          <div class="su-meter d-flex align-items-center gap-2 mt-2">
            <div class="su-segs d-flex gap-1 flex-grow-1" role="progressbar" aria-label="Password strength" aria-valuemin="0" aria-valuemax="4" aria-valuenow="0"><span></span><span></span><span></span><span></span></div>
            <span class="su-label small wdw-muted" aria-live="polite">Enter a password</span>
          </div>
        </div>
        <div class="col-sm-6">
          <label for="su-confirm" class="form-label small fw-semibold">Confirm password</label>
          <div class="input-group">
            <span class="input-group-text" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3 4 6v6c0 5 3.5 8 8 9 4.5-1 8-4 8-9V6z"/><path d="m9 12 2 2 4-4"/></svg></span>
            <input type="password" id="su-confirm" class="form-control" placeholder="Repeat password" autocomplete="new-password" required>
            </div>
            <div class="invalid-feedback">Passwords do not match.</div>
        </div>
        <div class="col-12 d-grid mt-4"><button type="submit" class="btn btn-primary rounded-pill">Create account</button></div>
        <p class="col-12 small wdw-muted text-center mb-0">By signing up you agree to our <a href="#">Terms</a> and <a href="#">Privacy Policy</a>.</p>
        <div class="col-12 alert alert-success d-none mb-0 py-2 text-center su-ok" role="status">Account created. Welcome aboard!</div>
      </form>
    </div>
    <p class="text-center wdw-muted mt-4 mb-0">Already have an account? <a href="#" class="fw-semibold">Log in</a></p>
  </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.