Skip to main content

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 bar
Live demo
Open ↗

When 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​

PropTypeRequiredDescription
lengthnumber—
valuestring—
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.
labelstring—
isDisabledboolean—
isInvalidboolean—
autoFocusboolean—
classNamestring—