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.
| Prop | Type | Default | Description |
|---|---|---|---|
| length | number | 6 | Number of boxes. |
| value | string | Controlled value. Pair it with onValueChange. | |
| defaultValue | string | "" | Initial value when uncontrolled. |
| onValueChange | (value: string) => void | Called with the current code whenever it changes. | |
| onComplete | (value: string) => void | Called once when every box is filled. | |
| numeric | boolean | true | Digits only (default), or any letters and numbers. |
| mask | boolean | Hide the characters, like a password. | |
| invalid | boolean | Show the error style. | |
| disabled | boolean | Disable all boxes. | |
| autoFocus | boolean | Focus the first box on mount. | |
| aria-label | string | "One-time code" | Accessible label for the input group. |
| className | string | Extra classes added to the outer element. |