About this set
Two sign-up flows for a fictional accounting app, built around per-step validation. Create an account, inline errors is a three-step signup (account, profile, confirm) with a work email, a password with a live requirements checklist that ticks as you type, a confirm-password field, a username with a pattern, a country select and a required terms checkbox. Passwordless sign-in is a compact two-step card: an email, then a six-digit one-time code with large spaced digits, a Resend code button with a 30 second cool-down and a Use a different email link. Use the first for new accounts, the second for magic-code logins. Validation relies on the browser’s own constraints (required, type, pattern, minlength and setCustomValidity for the password match) but replaces the browser bubbles with its own messages: on Continue every field in the step is checked, each failing field gets aria-invalid, a red border and a specific message with an icon, the signup form shows how many fields need attention, and focus moves to the first problem. Flagged fields re-check as you type, so messages clear as soon as they are fixed. The messages live in data attributes, so changing the wording needs no script edits. Without JavaScript every step shows and the browser validates on submit.
What’s included
- Native constraint validation with custom inline messages from data-msg-* attributes
- Focus moves to the first invalid field; a live summary counts the fields that need attention
- Live password checklist and a confirm-password match via setCustomValidity
- One-time code field with numeric keyboard, autofill hint and a resend cool-down
- One shared vanilla script, identical in the CSS, Bootstrap and Tailwind versions
Accessibility
Each field's error paragraph and hint are linked through aria-describedby, invalid fields get aria-invalid="true", and errors combine a red border with an icon and text so colour is never the only signal. The signup error count sits in a polite live region, the resend confirmation is announced politely, and the password checklist adds a hidden ", done" to each met rule. The stepper marks the current step with aria-current="step", focus moves to the new step heading or the first invalid field, every control has a visible focus style, and animations are switched off under prefers-reduced-motion.
Customise it
Change the --wz-accent, --wz-err and --wz-ok custom properties (plain CSS and Bootstrap, which also sets --bs-border-color on the card) or the wz-accent, wz-err and wz-ok colours in the Tailwind @theme block. Edit the data-msg-required, data-msg-type, data-msg-short, data-msg-pattern and data-msg-match attributes to reword the messages, and the data-rule regular expressions to change the password checklist.






