Skip to content
Sign upGet access
MicrointeractionsMatrix codeMenu

Matrix code (Pro)

ProIncluded in $99

A one time code on dot matrix panels that pours into a check.

ProEach digit scans onto its dot panel; the right code sends every lit dot flying into one big check, which settles beside Verified.

Each digit lights up on its panel in a quick top down scan, and the caret is the panel's bottom row of dots, blinking with a small wipe. Get the code right and every lit dot leaves its panel on a lifted arc and pours into one big dotted check, a light runs along it, and it settles small beside Verified. Get it wrong and the dots burst out, spring back in red and clear. A real input sits underneath, so typing, pasting and one time code autofill all work.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/matrix-code

Needs chatcn Pro

This command works with a Pro license, along with every Pro component.

Or start free: sign up and get three Pro components on us, with a new one every month.

Usage

tsx
import { MatrixCode } from "@/components/ui/chatcn/pro/matrix-code"

<MatrixCode verify={(code) => api.checkCode(code)} hint="Didn't get a code? Resend" />

verify can return a promise. Clear value after Verified to play the dots back home.

Props

PropTypeNotes
verify(code: string) => boolean | Promise<boolean>Runs once every digit is in
lengthnumberDefault 6, split in half
value / onValueChangestringOptional control
hintReactNodeUnder the panels
invalidMessage / verifiedLabelReactNode

Keyboard

KeyAction
0 to 9, pasteFill the code
BackspaceClear a digit
EscapeStart again after Verified

Accessibility

  • One real input with autocomplete=one-time-code; the wrong code message and Verified are announced as a status.

Motion

  • Digits scan in 110 ms; the dots fly 640 ms on a small spring and settle in 620 ms. Reduced motion: the check appears without the flight.