A verification code field built like a vault dial: each box is a drum with a column of numbers 0 to 9 that spins when you type and settles on your digit with a soft overshoot, blurred in motion and shaded like glass. Paste, SMS autofill, keyboard navigation and a resend countdown included.
Included in Pro and aboveCompare plans
Live preview. Move the mouse, scroll and click inside the frame.
import { OtpRollingDigits } from "@/components/hyperblur-pro/otp-rolling-digits"
<OtpRollingDigits length={6} onVerify={(code) => api.verify(code)} onComplete={(code) => console.log(code)} />| Prop | Type | Default | Description |
|---|---|---|---|
| length | number | 6 | Number of digits, from 4 to 8. |
| error | boolean | string | false | Puts the field in the error state. A string is also shown as the message. |
| onChange | (code: string) => void | Called on every edit with the digits entered so far. | |
| onComplete | (code: string) => void | Called when the last digit is filled, by typing, pasting or autofill. | |
| onVerify | (code: string) => boolean | void | Promise<boolean | void> | demo check | Called by the Verify button. Return false or reject to show the error. Without it the demo accepts demoCode. |
| onResend | () => void | Called when the Resend button is pressed after the countdown. | |
| resendSeconds | number | 30 | Seconds before the Resend button appears. |
| autoplay | boolean | true | Types the sample code by itself until the first interaction. |
| autoFocus | boolean | true | Focuses a box when the demo ends, or on mount when autoplay is off. |
| sampleCode | string | demoCode | Digits typed by the autoplay demo. |
| demoCode | string | "123456" | Code the demo Verify button treats as correct. |
| autoVerify | boolean | false | Verifies on its own after the autoplay demo finishes. |
| title | string | "Verify your account" | Card heading. |
| subtitle | string | per length | Text under the heading. |
| accent | string | "#7c5cff" | Accent color for focus, glow and the button. |
Source code is included in Pro and above