Back to components
OTP Digit Input React component

What is this?

A six-box verification code field. Typing moves to the next box, Backspace steps back, and pasting a code fills every box at once. The next empty box carries a blinking caret, and the boxes turn green when the code is complete. Swap the length and label, then drop it into a sign-in, 2FA, or email-confirm step.

Component

OTP Digit Input

A six-box verification code field. Typing moves to the next box, Backspace steps back, and pasting a code fills every box at once. The next empty box carries a blinking caret, and the boxes turn green when the code is complete. Swap the length and label, then drop it into a sign-in, 2FA, or email-confirm step.

Checking access…
Live Preview

Verified Technical Spec

Animation
CSS / Tailwind
Reduced motion
Verified
Keyboard focus
Verified
Compatibility
Tailwind CSS v3.4 + v4 · React 19 / Next.js 15 App Router + Vite / Remix compatible

Included

  • Copy source into Cursor or Claude for agent install
  • Finished React · TypeScript · Tailwind CSS UI

Dependencies

  • React 19.0.0
  • Typescript 5.7.2
  • Tailwindcss 3.4.16

Tech Stack

  • React
  • TypeScript
  • Tailwind CSS

Version 1.0.0