OTP input

A one-time code field. The focused box lifts and glows. Typing moves on, Backspace goes back, and pasting a code fills every box.

Install it the shadcn way: copy the source file into your project. It uses CSS 3D, Tailwind CSS v4 and Framer Motion, no WebGL.

OtpInput3D props

PropTypeDefaultDescription
lengthnumber6Number of boxes.
valuestringControlled value. Pair it with onValueChange.
defaultValuestring""Initial value when uncontrolled.
onValueChange(value: string) => voidCalled with the current code whenever it changes.
onComplete(value: string) => voidCalled once when every box is filled.
numericbooleantrueDigits only (default), or any letters and numbers.
maskbooleanHide the characters, like a password.
invalidbooleanShow the error style.
disabledbooleanDisable all boxes.
autoFocusbooleanFocus the first box on mount.
aria-labelstring"One-time code"Accessible label for the input group.
classNamestringExtra classes added to the outer element.

More components

Guides

Start

Cards

Scenes

Controls & text

Buttons

More cards

UI elements

Form controls

App components

Text & backgrounds

Showpieces

Blocks