OtpInput
v1.0.3Updated 28 Sept 2026Multi-cell digit / alphanumeric verification-code input built on the shadcn input-otp primitive. Configurable length and groups, paste support, auto-submit on complete, optional resend countdown (mm:ss), and three size s
Preview
Live · 11 stories▸Why this is recommendedformotpverificationcode+7
The default, out-of-the-box OtpInput.
- ✓Two-factor / MFA verification
- ✓Email or SMS verification
- ✓Magic-link backup code entry
- Configurable cell count + visual grouping
- Numeric or alphanumeric mode
- Paste full code support
- Auto-submit on complete (onComplete)
- Resend countdown timer (mm:ss) with cooldown
- Error state with red ring
- Three size scales (sm / md / lg)
- Labelled by FormField: the code input takes the id (its label names it) and the built-in "One-time code" name steps aside; FormField error paints the cells, and the own error joins aria-describedby
- ✕Long free-text codes (use Input)
- ✕Password entry (use PasswordInput)
Install
Ask your agent, or call the MCP tool directly. The resolved bundle is written into your project.
Usage
Tick variants in the left menu — each adds a tab with that variant’s real story source, the same code the preview above renders.
Props
valueControlled code
—onValueChangeValue callback
—lengthCell count (default 6)
—groupsCell grouping (default [3, 3])
—typeAllowed chars
—autoSubmitFire onComplete when full
—onCompleteFires when all cells filled
—resendableShow resend button + countdown
—resendCooldownSecondsCooldown (default 30)
—onResendResend callback
—sizeCell size
—errorError message
—aria-labelAccessible name; defaults to labels.ariaLabel ("One-time code") except inside a labelled FormField
—aria-labelledbyId(s) of the element(s) that label the code input; wins over a FormField label
—idDOM id set on the code input; FormField clones its field id in, and its label then names the control
—aria-describedbyId(s) of hint or error text describing the code input (FormField clones this in)
—aria-invalidMark the code input (also paints the cells) invalid; FormField clones this in from its error prop
—aria-requiredMark the code input required; FormField clones this in from its required prop
—