Kousthubha Yadiyala

Otp Input

Forms 5

About

otp input right and wrong UI

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

Code

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

Usage.tsx

"use client"

import { OTPInput } from "@/components/ui/otp-input"
import { useState } from "react"

export default function OTPInputDemo() {
  const [value, setValue] = useState("")
  const isValid = value.length === 6 && value === "123456"
  const isError = value.length === 6 && !isValid

  return (
    <div className="flex items-center justify-center min-h-screen bg-background">
      <div className="text-center space-y-4">
        <p className="text-sm text-muted-foreground">
          Enter code{" "}
          <span className="font-mono font-bold text-foreground">123456</span>
        </p>
        <OTPInput value={value} onChange={setValue} isError={isError} isValid={isValid} />
        <p className="text-xs text-muted-foreground h-4">
          {isValid ? "✓ Correct" : isError ? "✗ Incorrect code" : ""}
        </p>
      </div>
    </div>
  )
}

Dependencies

More by Kousthubha Yadiyala

View all
  • Morphing Card Stack

    Morphing Card Stack

    1.8K
  • Animated Menu

    Animated Menu

    603
  • Circular Command Menu

    Circular Command Menu

    466
  • Fluid Dropdown

    Fluid Dropdown

    421
  • Trello Kanban Board

    Trello Kanban Board

    317
  • Real time Analytics

    Real time Analytics

    287
  • Shatter Button

    Shatter Button

    276
  • Action Searchbar

    Action Searchbar

    221

More in Forms

View all
  • Premium Auth

    Premium Auth

    500
  • Login 1

    Login 1

    52
  • Authentication Card

    Authentication Card

    47
  • Book A Demo 3

    Book A Demo 3

    83
  • Book A Demo 1

    Book A Demo 1

    69
  • Contact Card

    Contact Card

    1K
  • Login Card

    Login Card

    32
  • Login 2

    Login 2

    7