deepraj21

Glass OTP Input

Forms 6

About

A one-time-passcode input made of refractive glass cells, with a single accessible input underneath for paste and SMS autofill, success/error states, and a sliding glass lens that tracks the active cell.

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

Code

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

Usage.tsx

"use client";

import * as React from "react";

import { GlassOTP } from "@/components/ui/glass-otp";

export default function GlassOTPDemo() {
  const [status, setStatus] = React.useState<"idle" | "success" | "error">(
    "idle",
  );

  // Synthetic verification: "123456" is the "correct" code for this demo.
  const verify = (code: string) => {
    setStatus(code === "123456" ? "success" : "error");
  };

  return (
    <div className="flex min-h-[320px] w-full items-center justify-center rounded-xl bg-gradient-to-br from-primary/10 via-background to-accent/20 p-10">
      <GlassOTP
        length={6}
        group={3}
        status={status}
        onFocus={() => setStatus("idle")}
        onComplete={verify}
      />
    </div>
  );
}

More by deepraj21

View all
  • Glass Sidebar

    Glass Sidebar

    51
  • Glass Message

    Glass Message

    42
  • Glass Tab Bar

    Glass Tab Bar

    32
  • Glass Date Picker

    Glass Date Picker

    27
  • Glass Notification

    Glass Notification

    16
  • Glass Tabs

    Glass Tabs

    15
  • Glass Input

    Glass Input

    11
  • Glass Switch

    Glass Switch

    11

More in Forms

View all
  • Form

    Form

    7
  • Login 2

    Login 2

    16
  • Contact Form

    Contact Form

    33
  • Contact Card

    Contact Card

    1.1K
  • Book A Demo 1

    Book A Demo 1

    95
  • Premium Auth

    Premium Auth

    613
  • Onboarding Stepper

    Onboarding Stepper

    13
  • Authentication Card

    Authentication Card

    52