Components
Input OTP
Segmented one-time-code entry with keyboard navigation.
Default
Enter the 6-digit code sent to your email.
<InputOTP maxLength={6} value={value} onChange={setValue}>
<InputOTPGroup>
<InputOTPSlot index={0} />
<InputOTPSlot index={1} />
<InputOTPSlot index={2} />
</InputOTPGroup>
<InputOTPSeparator />
<InputOTPGroup>
<InputOTPSlot index={3} />
<InputOTPSlot index={4} />
<InputOTPSlot index={5} />
</InputOTPGroup>
</InputOTP> Variants
1
2
Four Digits — maxLength 4, digits-only Pattern
B
U
E
Alphanumeric — letters and numbers
1
2
3
4
5
6
Disabled
1
2
Invalid — that code has expired
Pattern restricts allowed characters; combine with a Card, Field labels, and a Resend button for the full Form pattern.
import { REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp";
{/* Four Digits — digits-only Pattern */}
<InputOTP maxLength={4} pattern={REGEXP_ONLY_DIGITS}>…</InputOTP>
{/* Alphanumeric */}
<InputOTP maxLength={6} pattern={REGEXP_ONLY_DIGITS_AND_CHARS}>…</InputOTP>
{/* Disabled */}
<InputOTP maxLength={6} disabled defaultValue="123456">…</InputOTP>
{/* Invalid */}
<InputOTPSlot index={0} aria-invalid /> Markdown for agents: /design/input-otp.md · spec: /design.md