No.225 · Authentication
Strength Ring Sign-up
A sign-up form whose password border is the strength meter: a gradient line draws round the field as the password improves, closes the loop and floods the edge with light when every rule is met, while the rules tick off below.
The prompt
The design brief behind this component — reuse it to regenerate, remix, or explain it.
Build a create-account card (25rem): name, work email and password, a submit button and a sign-in link. The password field has no ordinary border. Measure it with a ResizeObserver and draw an SVG rounded-rect outline (14px radius) that starts just after the top-left corner and runs clockwise: a hairline track, and over it the same path with pathLength=1, a userSpace linear gradient stroke (blue → violet → amber) and stroke-dashoffset: 1 − p. p comes from the rules — at least 12 characters, a number, mixed case or a symbol, and not containing your name or email's local part — weighted 78% on rules met and 22% on length (capped below 1 until every rule is met), so the line keeps moving as you type and only closes when the password is actually good. Transition the offset with a slight overshoot (620ms). The stroke's opacity rises with the level, so a weak password draws a faint line. When every rule is met, a gradient layer under the input flashes to 26% with a spreading halo, then settles to a 7% tint (1.4s) — the ring 'floods' its edge. A mono label above the field reads Too short / Weak / Fair / Good / Strong (aria-live polite), coloured at the ends. Below, the rules are a two-column list; each has a circle that fills green as a white check draws itself in (pathLength dash). The input is aria-describedby the list, and each rule carries a hidden ', done' / ', not yet'. Show/hide is an aria-pressed eye button. Submit validates in order and shows one role=alert error in plain language; success replaces the form with a drawn check and 'We sent a link to …'. Paper and Night.
Notes
- Interaction
- Type a password and watch the ring draw round the field; meet every rule to close and flood it. Show/hide with the eye.
- Motion
- Ring 620ms with overshoot; flood 1.4s once on reaching Strong; rule checks draw in 380ms; success check draws in 700ms.
- Accessibility
- Real labels and autocomplete (name, email, new-password). The strength word is a polite live region, the rules are linked with aria-describedby and say whether each is met, and errors use role=alert with aria-invalid on the field. The eye is a pressed toggle. Reduced motion jumps the ring and drops the flood flash.
- Responsive
- Up to 25rem; rules fall to one column under 420px. The ring is remeasured on resize.
- On touch
- Identical on touch.