Verification code
Auth3 pieces3 statesEnter a one-time code sent by SMS, email or an authenticator app: one box per digit, paste fills them all, the last digit submits, and 'Resend' waits for a countdown. For MFA at login, confirming an email at sign-up, or approving a payment.
In every theme
Same block, same props. Only the tokens change.
Pulse
HealthRelay
SaaSStates
default · error · loading
default
error
loading
Sector rules · 5
Returned as sectorRules. Your agent applies the ones for your industry.
Health
2 rules- 01
Require it at every login on a device not used in the last 30 days, and before showing results or prescriptions.
- 02
Offer backup codes under 'Use another method'; a lost phone must not lock someone out of their care.
Fintech
3 rules- 01
Ask for it again before sending money to a new recipient or changing the phone number.
- 02
Prefer an authenticator app or push approval over SMS; keep SMS as a fallback.
- 03
Lock verification for 15 minutes after 5 wrong codes and say how long to wait.
Built from the library
Every piece links to its own spec.
| Prop | Type | Description |
|---|---|---|
| onComplete | (code: string) => void | Called when every box is filled (typed or pasted) and on submit. |
| destination | string | Where the code went, masked: '+34 •••• •• 42' or 'j•••@mail.com'. |
| length | number | Number of digits. |
| error | string | Server error, e.g. 'That code is wrong or expired'; clears the boxes. |
| loading | boolean | Locks the boxes; the button shows the spinner and 'Verifying'. |
| onResend / resendSeconds | () => void / number | Resend link, enabled after the countdown; it restarts on every resend. |
| onUseAnotherMethod | () => void | Ghost button to switch to email, an authenticator app or a backup code. |
npx shadcn add https://unbuiltui.com/r/verification-code.json