Password reels
NewA sign-up card with a combination lock for an icon: each password rule met spins the next number reel to a green tick.
password-reels/password-reels.tsxThe live component, numbered part by part. Every measurement is read from it as it is drawn. Point at a row to outline its part, or at a part to find its row.
The choices it offers, each value drawn live and the default marked, with how to pick one.
When to use
- The step of a sign-up where someone chooses a password, when the card has nothing else to do: one field, one button.
- A product that wants this moment to feel like a small object working, since the reels are the whole point of the card.
- Rules that can be checked as the person types, so each one can answer straight away.
When not to use
- Signing in. An existing password has no rules to meet, and the checklist would tell an onlooker nothing useful.
- A form with other fields around the password. Use a plain field with the rules under it; the card and its icon need the space.
- Rules that need the server, such as “not used before”. Those answers arrive late and can’t turn a reel on a keystroke.
- More than five or six rules: the card gets tall and four reels no longer map to anything a reader can follow.
The sequence
- First character: the card grows on a spring in 0.6 s, and the rows blur in from the top, 55 ms apart.
- A rule met: its disc fills, its words turn from the left in 0.35 s, and the next reel from the left turns five faces to a tick in 0.62 s.
- Every rule met: the button turns solid at once. After 0.55 s, when the last reel has landed, the padlock closes and the list leaves from the bottom up, 50 ms apart.
- Then: the card folds in 0.24 s with no spring, and “Strong password” blurs in.
- Deleting: every step runs backwards. A reel unwinds from the right, and the list comes back as soon as a rule is lost.
What the reels mean
- They count, they don’t name: a reel doesn’t stand for a rule. The first rule met turns the first reel, whichever rule it was.
- They are decoration: nothing depends on seeing them. The checklist carries the same information in words.
Each one drawn with the component itself, used well or badly.
The words are the title, the placeholder, the rules, the strong row, the button and the terms.
- The title says what to do:
Set your password. - Rules say what is needed, in sentence case with no full stop:
At least 8 characters. - The strong row says the outcome in two words:
Strong password. - The button names what comes next, not the field:
Create account.
You can add this component with the shadcn CLI or by hand:
Into components/password-reels of any React project, with no setup:
npx shadcn@latest add https://brunodelorence.com/r/password-reels.json- Copy the component files
Copy these files into one folder of your project, keeping their relative imports together, or download them as a ZIP:
- Import it
As shown under Usage, below.
Either way it needs React 19.2 and a bundler that supports CSS Modules, such as Next.js or Vite. It has a dark colour scheme: it follows your page’s color-scheme, light unless the page sets one, or its colorScheme prop, with nothing to configure. Browsers without light-dark() show it light.
Usage
import { PasswordReels } from './password-reels';export function SignUpStep({ createAccount, goBack }) { return ( <PasswordReels onSubmit={createAccount} onBack={goBack} terms={ <> By continuing you agree to our <a href="/terms">terms</a>. </> } autoplay={false} /> );}Each state below is a live instance, locked so you can study it.
The pieces it is built from, each with its measurements read live.
A white card with a back chevron, a dark squircle icon holding four number reels, the title Set your password, a real password field with a padlock, a disabled Create account button and a line of small print. The first character opens a checklist: at least 8 characters, a number, an uppercase letter, a symbol. Each rule met turns green, and the next reel from the left spins to a tick, whichever rule it was. With all four met the button turns solid, the padlock closes and turns green, and the list folds into one Strong password row. Deleting unwinds it all.
- Each reel is a real drum in CSS 3D: faces 30° apart on a 68 px radius under a 320 px perspective, set back by its radius so the front face keeps its size. The rows above and below the middle lean away and shorten because they are on a cylinder. Each reel has its own perspective, so all four are seen straight on.
- A turn is five faces and one CSS transition of the `rotate` property, which the compositor runs. Timed frame by frame, it covers a face every 33 ms at the start, reaches its mark at 0.3 s, goes 13% of a face past at 0.37 s and is back by 0.62 s; that curve is written as a `linear()` easing. Several reels turning at once (a pasted password) start 70 ms apart.
- The motion blur is a filter on the reel’s own 22 px box, up to 0.9 px for the first 0.38 s of a turn and removed afterwards. The shading never moves: a vertical gradient over the window goes from 94% black at the edges to clear across the middle 16%, so a numeral dims as it rolls away. Under it each reel has an elliptical glow, and between them are black ratchet teeth 3 px apart.
- The numerals are one stroke each on a 12 × 20 grid, drawn in SVG, so they are the same condensed shapes on every system with no font to load.
- The card never lays out as it grows. `--extra` is the height the rows need (135 px for four rules, 50 px for the strong row): the button and terms slide down by it with `translate`, the card slides up by half to stay centred, and only a childless sheet behind them changes height.
- Growing is a spring with a 7% overshoot, at its peak after 0.2 s and settled in 0.6 s. Folding is 0.24 s with no overshoot, after a 0.15 s wait.
- Rows blur in from 4 px over 0.24 s, top first and 55 ms apart; they leave over 0.16 s, bottom first and 50 ms apart. A rule’s words turn green from the left in 0.35 s by sliding a gradient clipped to the text, with a soft edge.
- When the last rule is met the button changes at once. The padlock closes and the list folds 0.55 s later, once the last reel has landed; losing a rule undoes that straight away.
- The value lives in the input and in the caller’s state. It is not logged or stored, and the live region says only which rules changed. While on screen and untouched, a demo pointer clicks the field, types a sample phrase over 5 s, holds, and deletes it about every 13 s; the field never takes the real focus, and any input from the reader stops the demo and clears the phrase.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | The password, when the caller holds it. Passing it also turns the demo off. |
defaultValue | string | '' | Where an uncontrolled field starts; anything but empty turns the demo off. |
onChange | (value: string) => void | — | Called on every change the reader makes. The demo’s typing does not call it. |
onSubmit | (value: string) => void | — | Called with the password when the form is sent, which only works with every rule met. |
rules | PasswordRule[] | DEFAULT_RULES | Each is { id, label, test(value) }. The default is length 8, a number, an uppercase letter and a symbol. There are always four reels: with another number of rules they fill in proportion. |
title | ReactNode | 'Set your password' | The card’s heading. |
label | string | 'Password' | The field’s label, visually hidden. |
placeholder | string | 'Your password' | The hint in the empty field. |
submitLabel | string | 'Create account' | The button’s words. |
strongLabel | string | 'Strong password' | What the single row says with every rule met; it is announced too. |
name | string | 'password' | The input’s name in the form. |
onBack | () => void | — | Called by the default back button, which does nothing without it. |
back | ReactNode | — | Takes the place of the default back button; null leaves it out. |
terms | ReactNode | A plain sentence, with no links | The small print under the button; null leaves it out. |
autoplay | boolean | true | Plays the demo while on screen and untouched, in an uncontrolled, empty field. Never under reduced motion. |
colorScheme | 'light' | 'dark' | 'system' | — | Forces a scheme; without it the page’s color-scheme decides. The icon stays dark. |
className | string | — | Added to the stage. |
Focus and keyboard
- Tab goes from Back to the field, then to the button once it is enabled. Enter in the field sends the form only with every rule met.
- The field’s edge darkens on focus, and the buttons show a 2 px ring on keyboard focus.
Screen readers
- The field has a real label and is described by the rules, so they are read out on arrival, even before the list is on screen.
- A polite live region says what changed once typing rests for 0.7 s, such as “A number: met. 2 of 4 met.”, and never the value.
- Each rule’s row ends in a hidden “met” or “not met”, since the green is only colour. The reels, the padlock and the demo pointer are hidden.
Password managers
It is an ordinary type="password" input with autoComplete="new-password" in a real form, so managers can offer and fill a password; pasting turns several reels at once, 70 ms apart.
Motion
With reduced motion the reels jump to their faces with no spin or blur, the card changes height at once, and rows only fade in 0.15 s. The demo does not play.
In this build
- A real form with a labelled `type="password"` input and `autoComplete="new-password"`, so password managers work; the button is natively disabled until every rule passes, and Enter sends only then.
- The field is described by the rules (or by the strong row once it shows), so they are read on arrival, even before the list appears.
- A polite live region says what changed once typing rests for 0.7 s, such as “A number: met. 2 of 4 met.”, and never the value. It stays quiet while the demo plays.
- Each row ends in a hidden “met” or “not met”, since green alone says nothing to some readers. The reels, the padlock and the demo pointer are hidden from assistive technology.
- Rule, placeholder and terms text reach 4.5:1 on the card in both schemes.
- With reduced motion the reels jump to their faces, the card changes height at once, and rows only fade in 0.15 s; the demo does not play.
The complete source behind this demo. Open source under the MIT license, © 2026 Bruno Delorence: copy it, change it, ship it.
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useEffect, useEffectEvent, useId, useMemo, useRef, useState, type CSSProperties, type ChangeEvent, type FormEvent, type ReactNode,} from 'react';import { DemoPointer, runDemo, type Point } from './demo-pointer';import { Chevron, Numeral, Padlock, ReelTick, RuleTick } from './reels';import { useAutoplay } from './use-autoplay';import styles from './password-reels.module.css';/* * Password reels: a sign-up card whose icon is a combination lock of four number reels. Typing * opens a checklist under the field; each rule met turns green and spins the next reel from the/* Password reels (password-reels.tsx): a sign-up card on a pale stage. Its icon is a dark squircle with four number reels; a checklist opens under the field as it is typed in. Sizes are px: a 360 px card with a 22 px radius and 30 px sides, a 106 px icon with 9 px of bezel, a 39 px field and a 39 px button 14 px round, rows 29 px apart. The card's own layout never changes. --extra is the height the rows need: the tail slides down by it, the card up by half of it, and the sheet behind them (a box with no children) grows by it. The reels are dark in both schemes: the object doesn't change colour at night, the page does. */.root { --stage: #f7f7f7; --sheet: #fdfdfd; --sheet-edge: rgb(0 0 0 / 0.045); --sheet-shadow: rgb(0 0 0 / 0.035); --ink: #2a2a2d; --muted: #75757b; --back: #f3f3f3; --back-hover: #ececec; --back-ink: #66666b; --field-edge: #ececee; --field-edge-focus: #8a8a90; --field-edge-demo: #d6d6d9;// Copyright (c) 2026 Bruno Delorence. MIT License./* * The drawn pieces: the condensed numerals of the reels (one stroke each, the same on every * system, so no font is needed), the green tick, the chevron, the padlock and the rule's tick. *//** Stroke paths on a 12 × 20 grid. */const NUMERALS: Record<string, string> = { '0': 'M6 1.6C3 1.6 1.6 3 1.6 5.6v8.8c0 2.6 1.4 4 4.4 4s4.4-1.4 4.4-4V5.6c0-2.6-1.4-4-4.4-4z', '1': 'M2.8 5.2 7.2 1.8V20', '2': 'M1.7 6.2C1.7 3.2 3.2 1.6 6 1.6s4.3 1.5 4.3 4.2c0 2-1 3.5-2.5 5.4l-5.8 7.3H11', '3': 'M1.6 5.6C1.8 3 3.4 1.6 6 1.6s4.3 1.5 4.3 4.1-1.7 4.1-4.9 4.1c3.5 0 5.1 1.5 5.1 4.4s-1.8 4.2-4.5 4.2-4.3-1.4-4.5-4', '4': 'M8.5 20V2.2L1.5 14.4H11.8', '5': 'M10.2 1.6H3.1l-.6 8.2c.9-1 2.1-1.5 3.5-1.5 2.9 0 4.4 2 4.4 5.1s-1.6 5-4.4 5c-2.5 0-4-1.4-4.4-3.8', '6': 'M9.8 3.2C9 2.2 7.8 1.6 6.4 1.6c-3.2 0-4.8 2.6-4.8 8.4v4c0 2.9 1.7 4.4 4.4 4.4s4.4-1.6 4.4-4.5-1.6-4.5-4.2-4.5c-2 0-3.7 1-4.6 2.9', '7': 'M.6 1.6h10.8L5 20', '8': 'M6 9.6c-2.7 0-4.2-1.5-4.2-4S3.3 1.6 6 1.6s4.2 1.5 4.2 4-1.5 4-4.2 4zm0 0c-3 0-4.6 1.6-4.6 4.4s1.6 4.4 4.6 4.4 4.6-1.6 4.6-4.4-1.6-4.4-4.6-4.4z',};export function Numeral({ value, className }: { value: string; className?: string }) { return ( <svg className={className} viewBox="0 0 12 20" fill="none" stroke="currentColor"> <path// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useCallback, useEffect, useRef, useState } from 'react';/* * When a demo may play on its own: while part of it is on screen and the tab is visible, never * under reduced motion, and never again once the reader has used it: `take()` hands it to the * reader for good (until the component mounts again), so it can't come back on its own. */export function useAutoplay<T extends HTMLElement>() { const ref = useRef<T>(null); const [visible, setVisible] = useState(false); const [reduced, setReduced] = useState(true); const [taken, setTaken] = useState(false); useEffect(() => { const element = ref.current; if (!element) return; let onScreen = false; const update = () => setVisible(onScreen && !document.hidden); const observer = new IntersectionObserver( ([entry]) => {// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import type { CSSProperties, Ref } from 'react';/* * The demo's pointer, and the steps that move it. A demo is a script of awaited steps: wait, or * glide the pointer somewhere. Stopping the demo (the reader takes over, or it scrolls away) ends * the step in progress at once: its promise rejects, which ends the script right there, and the * pointer fades out. * * Each glide is a curved flight played by the Web Animations API, so nothing runs frame by frame. * The points of the flight are handed to whoever wants to move along with it (nothing here uses * them yet). The arrow and the text cursor are HTML boxes * that swap by their visibility: a change of style inside an SVG would lay the SVG out again. */export type Point = { x: number; y: number };/** A glide's path and timing, for an animation that plays along with it. */export type Flight = { points: Point[]; timing: KeyframeAnimationOptions };export type Demo = {