Input OTP
Displays an OTP input field built on the Base UI OTPField primitive.
Installation
Bash
Usage
Examples
Masked
API reference
InputOTP
Extends the Base UI OTP Field Root — all its props apply. No third-party input-otp package required.
| Prop | Type | Default |
|---|---|---|
length | number (required) | — |
value / defaultValue | string | — |
onValueChange | (value: string) => void | — |
onValueComplete | (value: string) => void — all slots filled | — |
validationType | "numeric" | "alpha" | "alphanumeric" | "none" | "numeric" |
mask | boolean | false |
autoSubmit | boolean — submit the owning form when complete | false |
InputOTPSlot
Extends the Base UI Input part — each slot is a real single-character
input; render exactly length of them. Focus styling replaces the old
fake-caret behavior.
InputOTPGroup and InputOTPSeparator
InputOTPGroup (a div) draws the joined slot borders and rounded
ends; InputOTPSeparator extends the Base UI Separator and renders a
minus icon between groups.