jshguo

Input OTP

Component 160

About

Accessible one-time password component with copy paste support.

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

"use client"

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

export default function InputOTPDefaultDemo() {
  return (
    <div className="flex min-h-screen w-full items-center justify-center overflow-hidden bg-background p-8">
      <InputOTP maxLength={6} pattern={REGEXP_ONLY_DIGITS}>
        <InputOTPGroup>
          <InputOTPSlot index={0} />
          <InputOTPSlot index={1} />
          <InputOTPSlot index={2} />
        </InputOTPGroup>
        <InputOTPSeparator />
        <InputOTPGroup>
          <InputOTPSlot index={3} />
          <InputOTPSlot index={4} />
          <InputOTPSlot index={5} />
        </InputOTPGroup>
      </InputOTP>
    </div>
  )
}

Dependencies

More by jshguo

View all
  • Progress

    Progress

    426
  • Select

    Select

    369
  • Textarea

    Textarea

    258
  • Interfaces Carousel

    Interfaces Carousel

    160
  • Switch

    Switch

    136
  • Hover Card

    Hover Card

    109
  • Card

    Card

    85
  • Interfaces Breadcrumb

    Interfaces Breadcrumb

    63