Component
Combination-Lock OTP
Variants
The same markup drops into a normal page as a compact CSS safe dial (no WebGL needed). It re-themes with the colour tokens. Sizes and states below.
Usage
Paste the markup, include assets/css/tokens.css and assets/css/tailwind.css, then run the script from this page. Check the code in the verify function (demo only: replace with your API) and listen for cmlo:result.
Accessibility
- Role and state. Six real text inputs in a labelled group, each named "Digit n of 6", with inputmode numeric and autocomplete one-time-code so phones offer the SMS code. A polite live region announces unlocked or wrong code; the dial itself is decorative and hidden from assistive tech.
- Keyboard. Type a digit and focus moves on, Backspace steps back, arrows move between boxes, ArrowUp and ArrowDown turn the dial to the next or previous digit, and pasting six digits fills the whole code. Clear is a normal button.
- Reduced motion. With prefers-reduced-motion the dial jumps to each digit, the vault opens to its end state at once, and there is no rattle, no sparks and no shake; the status text and the green boxes still show the result.
- Touch and pointer. The dial drags with pointer capture and touch-action off, snaps to a whole number on release and commits that digit. The boxes are at least 36 px wide and 44 px tall.