- Components
- Forms
Input OTP
One-time code input on Base UI's OTPField. Slots are separate tiles; the focused one takes the page fill.
Installation#
npx shadcn add @ortaui/input-otpExamples#
Six digits#
Four digits, disabled and invalid#
API reference#
| Prop | Type | Default | Description |
|---|---|---|---|
| surface | "default" | "raised" | auto | Look on a panel. Unset: raised (page fill + border) inside any [data-surface] container. "raised" forces it anywhere; "default" keeps the muted fill even inside a surface. |
| length | number | - | Number of slots. Render exactly that many InputOTPSlot. |
| value / defaultValue | string | - | Controlled or uncontrolled value. |
| onValueComplete | (value) => void | - | Called when every slot is filled. |
| validationType | "numeric" | "alpha" | "alphanumeric" | "none" | - | Allowed characters. |