Skip to content

Signup Form with Validation

Bootstrap 5 signup form with live password rules, a strength meter, show/hide toggle, password confirmation and a required terms checkbox.

Also known as: signup form password strength, registration form with validation, create account form, password strength meter form

Signup Form with Validation live demo

Open in new tab

Bootstrap 5 code (HTML, CSS, JS)

A Bootstrap 5 signup form with live password rules, a four-step strength meter, a show/hide password toggle, password confirmation and a required terms checkbox, shown on a violet gradient background. Use it for SaaS registration pages, free trial sign-ups and account creation screens.

How it works

The root is section.su-signup, and the form sits in a centered .su-card that is 480px wide at most. The .su-form uses novalidate, so the browser's own bubbles are replaced by Bootstrap invalid-feedback messages. First and last name share a row from the sm breakpoint; the email field adds a pattern that requires a dot in the domain.

The password lives in an input-group has-validation with the .su-reveal button. On every input the script runs the functions in the RULES object (length, upper, number, symbol) against the value. Each matching li[data-su-rule] in .su-rules gets .su-rule--met and a check icon, and the number of met rules is written to data-su-level on .su-meter, which colors one to four bar segments while .su-meter__text reads weak, fair, good or strong. Until every rule passes, setCustomValidity() keeps the password invalid; the same method flags .su-confirm when it does not match. The reveal button switches both fields between password and text.

On submit the script calls checkValidity(). An invalid form gets was-validated, every field gets aria-invalid and its error text in aria-describedby, and the first invalid field is focused. A valid form shows a spinner on .su-submit, then hides the form and reveals .su-success with the entered email address.

Customization

  • --su-from and --su-to in .su-signup: change the page gradient and the logo badge.
  • --su-accent, --su-accent-hover and --su-accent-rgb in .su-signup: recolor the submit button, links, checkbox and focus rings.
  • --su-weak, --su-fair, --su-good and --su-strong in .su-signup: set the colors of the strength meter levels.
  • The RULES object in script.js plus a matching li[data-su-rule]: add a rule such as a 12-character minimum or remove the symbol requirement.
  • max-width: 480px in .su-card: make the card wider or narrower.
  • The window.setTimeout call in the submit handler: replace it with a fetch() to your sign-up API and show server errors in the form.

Use cases

  • SaaS registration pages: live password rules and a strength meter guide users to a secure password
  • Free trial sign-ups: first name, last name, email and terms checkbox sit in one compact card
  • Account creation screens: a show/hide toggle and confirm field reduce typing mistakes
  • Membership sites: a success panel shows the entered email address after a valid submit

Accessibility

Every field has a visible label, and autocomplete values (given-name, email, new-password) help password managers. The password is always described by the #su-rules list, and each rule carries hidden "(met)" or "(not met)" text. The strength label is a polite live region. The reveal button has aria-controls, aria-pressed and a label that switches between "Show password" and "Hide password". During sending the submit button uses aria-disabled, so focus stays on it, and the success panel receives focus when it appears. Transitions and the success animation are removed with prefers-reduced-motion: reduce.

Usage notes

Requires Bootstrap 5 and Bootstrap Icons. Client-side rules improve the experience but are not security: validate and hash passwords on the server.

Signup Form with Validation at a glance

Framework
Bootstrap 5
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 5, Bootstrap Icons
Layout
Responsive, works on mobile
Category
Login & Sign Up
License
Free for personal and commercial use

Questions about this template

Can I use the Signup Form with Validation code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 5 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
Signup Form with Validation – free Bootstrap 5 login & sign up form template
Signup Form with Validation · free Bootstrap 5 login & sign up form template

More Login & Sign Up

Login Form with Floating Labels – free Pure CSS login & sign up form template

Login Form with Floating Labels

Clean pure CSS login card with animated floating labels, show/hide password, inline validation and a simulated sign-in state in vanilla JavaScript.

Forgot Password Form – free Tailwind CSS login & sign up form template

Forgot Password Form

Tailwind CSS forgot password form with email validation, loading spinner, check-your-inbox success state and a resend cooldown timer.

Split Login Page with Image – free Bootstrap 6 login & sign up form template

Split Login Page with Image

Bootstrap 6 split-screen login page with a full-height photo and testimonial on one side and a floating-label form with Google and Apple sign-in on the other.

Forgot Password Form – free Bootstrap 6 login & sign up form template

Forgot Password Form

Bootstrap 6 forgot password form with an email field, inline validation, a loading button, a stepper and a check-your-inbox success state with resend timer.

Login and Signup Tabs – free Bootstrap 6 login & sign up form template

Login and Signup Tabs

Bootstrap 6 card with segmented tabs that switch between a sign-in form and a create-account form, with validation, cross-links and simulated submits.

OTP Verification Form – free Bootstrap 6 login & sign up form template

OTP Verification Form

Bootstrap 6 two-factor verification card using the new OtpInput component, with grouped digit slots, auto-submit, attempt limit, resend countdown and trust-device switch.