Component

OTP 6-Digit Input

One-time password input components with verification code styling

  • Component
  • Tailwind
  • MIT

Preview

Live component

Interactive preview
Open preview
9:41 100%
devsnips.site/library/tailwind/components/input/otp-6-digit/
fluid · no fixed width 100%
No dependencies Production-ready

Install

Add to your project

terminal
npx devsnips add Tailwind/Components/Input/otp-6-digit
registry path: Tailwind/Components/Input/otp-6-digit

Source

Implementation

code.html
<!-- OTP 6-Digit - Standard -->
<div>
  <label class="block text-sm font-medium text-gray-700 mb-3 text-center">Enter verification code</label>
  <div class="flex justify-center gap-2 sm:gap-3">
    <input type="text" maxlength="1" class="w-10 h-12 sm:w-12 sm:h-14 bg-white border-2 border-gray-300 rounded-lg text-center text-xl font-bold focus:outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 transition-colors" />
    <input type="text" maxlength="1" class="w-10 h-12 sm:w-12 sm:h-14 bg-white border-2 border-gray-300 rounded-lg text-center text-xl font-bold focus:outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 transition-colors" />
    <input type="text" maxlength="1" class="w-10 h-12 sm:w-12 sm:h-14 bg-white border-2 border-gray-300 rounded-lg text-center text-xl font-bold focus:outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 transition-colors" />
    <input type="text" maxlength="1" class="w-10 h-12 sm:w-12 sm:h-14 bg-white border-2 border-gray-300 rounded-lg text-center text-xl font-bold focus:outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 transition-colors" />
    <input type="text" maxlength="1" class="w-10 h-12 sm:w-12 sm:h-14 bg-white border-2 border-gray-300 rounded-lg text-center text-xl font-bold focus:outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 transition-colors" />
    <input type="text" maxlength="1" class="w-10 h-12 sm:w-12 sm:h-14 bg-white border-2 border-gray-300 rounded-lg text-center text-xl font-bold focus:outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 transition-colors" />
  </div>
  <p class="mt-4 text-sm text-gray-500 text-center">Code sent to your email</p>
</div>

<!-- OTP 6-Digit - Dark -->
<div class="mt-6 p-6 bg-slate-900 rounded-xl">
  <label class="block text-sm font-medium text-gray-300 mb-3 text-center">Enter 2FA Code</label>
  <div class="flex justify-center gap-2 sm:gap-3">
    <input type="text" maxlength="1" class="w-10 h-12 sm:w-12 sm:h-14 bg-slate-800 border-2 border-slate-600 rounded-lg text-center text-xl font-bold text-white focus:outline-none focus:border-blue-400 focus:ring-2 focus:ring-blue-400/20 transition-colors" />
    <input type="text" maxlength="1" class="w-10 h-12 sm:w-12 sm:h-14 bg-slate-800 border-2 border-slate-600 rounded-lg text-center text-xl font-bold text-white focus:outline-none focus:border-blue-400 focus:ring-2 focus:ring-blue-400/20 transition-colors" />
    <input type="text" maxlength="1" class="w-10 h-12 sm:w-12 sm:h-14 bg-slate-800 border-2 border-slate-600 rounded-lg text-center text-xl font-bold text-white focus:outline-none focus:border-blue-400 focus:ring-2 focus:ring-blue-400/20 transition-colors" />
    <input type="text" maxlength="1" class="w-10 h-12 sm:w-12 sm:h-14 bg-slate-800 border-2 border-slate-600 rounded-lg text-center text-xl font-bold text-white focus:outline-none focus:border-blue-400 focus:ring-2 focus:ring-blue-400/20 transition-colors" />
  </div>
</div>

<!-- OTP 6-Digit - With Resend -->
<div class="mt-6 text-center">
  <label class="block text-sm font-medium text-gray-700 mb-3">One-Time Password</label>
  <div class="flex justify-center gap-2 mb-4">
    <input type="text" maxlength="1" class="w-11 h-13 bg-white border-2 border-gray-200 rounded-xl text-center text-lg font-bold focus:outline-none focus:border-green-500 focus:ring-2 focus:ring-green-500/20 transition-colors" />
    <input type="text" maxlength="1" class="w-11 h-13 bg-white border-2 border-gray-200 rounded-xl text-center text-lg font-bold focus:outline-none focus:border-green-500 focus:ring-2 focus:ring-green-500/20 transition-colors" />
    <input type="text" maxlength="1" class="w-11 h-13 bg-white border-2 border-gray-200 rounded-xl text-center text-lg font-bold focus:outline-none focus:border-green-500 focus:ring-2 focus:ring-green-500/20 transition-colors" />
    <input type="text" maxlength="1" class="w-11 h-13 bg-white border-2 border-gray-200 rounded-xl text-center text-lg font-bold focus:outline-none focus:border-green-500 focus:ring-2 focus:ring-green-500/20 transition-colors" />
  </div>
  <p class="text-sm text-gray-500">Didn't receive the code? <button class="text-blue-600 hover:text-blue-700 font-medium shrink-0 whitespace-nowrap">Resend</button></p>
</div>
36 lines UTF-8 · LF · Spaces: 2
DevSnips AI ready Claude · Cursor · Windsurf

Agent skill & Model Context Protocol

Pass this component straight into your AI workflow. DevSnips exposes each resource as a structured, addressable registry entry, so your agent installs the real files instead of approximating them.

devsnips://components/input/otp-6-digit
Prompt instruction
I want to use this DevSnips resource in production:

Page:
https://devsnips.site/library/tailwind/components/input/otp-6-digit/

Install: npx devsnips add
Tailwind/Components/Input/otp-6-digit

This is the OTP 6-Digit Input — One-time password input components with verification code styling

Use this DevSnips resource as the starting point for my project.
Adapt it to my project's stack and conventions, fix any issues,
and make it production-ready while preserving its intended design
and behavior.

Paste into ChatGPT, Claude or your agent — it already carries the page URL and the exact install path.

Resource URI
devsnips://components/input/otp-6-digit