OTPInput
Fixed-length code entry, one box per character. Paste fills the whole code.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
Fixed-length code entry, one box per character.
Accessibility
Fully keyboard operable: Tab to focus, Enter/Space to activate. The visible focus ring uses --focus-ring — never remove it. Provide an accessible label (aria-label) for icon-only controls.
Install and import
npx shadcn@latest add @prism/otp-input
import { OTPInput } from '@/components/prism/OTPInput';
In a no-build prototype, read it from the bundle instead: const { OTPInput } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
length | number | — | |
value | string | — | |
onChange | (value: string) => void | — | |
onComplete | (value: string) => void | — | Fires once the last character lands — usually submits. |
type | "numeric" | "alphanumeric" | — | "numeric" restricts to digits; "alphanumeric" upper-cases as you type. |
label | string | — | |
isDisabled | boolean | — | |
isInvalid | boolean | — | |
autoFocus | boolean | — | |
className | string | — |