Input OTP
Captures one-time passcodes through one accessible native input and a precise segmented display.
@rivetui/input-otpPreview
Explore each composition interactively, then open its code in the same context.
Verification code
Use one native input behind a precise segmented display. 0 of 6 digits entered.
Alphanumeric
Switch the pattern and input mode when a code contains both letters and digits.
R
V
8
Invalid code
Associate the segmented input with a concise error when server-side verification fails.
0
0
0
0
0
0
This code has expired.
Registry
Installation
Add the component source and its declared dependencies with the shadcn CLI.
Install component
bunx --bun shadcn@latest add @rivetui/input-otpPublic interface
API reference
Component-specific props are listed here. Native element and Base UI props continue to pass through.
InputOTP
| Prop | Type | Default |
|---|---|---|
maxLength | number | required |
value | string | — |
defaultValue | string | "" |
onValueChange | (value: string) => void | — |
onComplete | (value: string) => void | — |
pattern | string | RegExp | — |
inputMode | HTMLInputModeAttribute | "numeric" |
autoComplete | string | "one-time-code" |
pasteTransformer | (pasted: string) => string | — |
disabled | boolean | false |
InputOTPSlot
| Prop | Type | Default |
|---|---|---|
index | number | required |