crysta1221

Input OTP

Forms

About

A one-time-password input made of individual boxed digit slots, used for verification codes in sign-in and two-factor flows.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Input OTP to your project and fits it to your theme.

Code

How Input OTP is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import {
  InputOTP,
  InputOTPGroup,
  InputOTPSeparator,
  InputOTPSlot,
} from "@/components/ui/input-otp";

export default function Demo() {
  return (
    <InputOTP
      aria-label="Verification code"
      maxLength={6}
      containerClassName="w-full max-w-sm"
    >
      <InputOTPGroup className="min-w-0 flex-1">
        <InputOTPSlot index={0} className="min-w-0 flex-1" />
        <InputOTPSlot index={1} className="min-w-0 flex-1" />
        <InputOTPSlot index={2} className="min-w-0 flex-1" />
      </InputOTPGroup>
      <InputOTPSeparator />
      <InputOTPGroup className="min-w-0 flex-1">
        <InputOTPSlot index={3} className="min-w-0 flex-1" />
        <InputOTPSlot index={4} className="min-w-0 flex-1" />
        <InputOTPSlot index={5} className="min-w-0 flex-1" />
      </InputOTPGroup>
    </InputOTP>
  );
}

Dependencies

More by crysta1221

View all
  • Attachment

    Attachment

    20
  • M3 Expressive Button

    M3 Expressive Button

    19
  • Empty

    Empty

More in Forms

View all
  • Login 1

    Login 1

    64
  • Premium Auth

    Premium Auth

    571
  • Contact Card

    Contact Card

    1.1K
  • Form

    Form

    18
  • Book A Demo 1

    Book A Demo 1

    91
  • Authentication Card

    Authentication Card

    52
  • Card Studio

    Card Studio

    47
  • Login Card

    Login Card

    35