Componentpickers1.02 KB gzipZero dependencies

Otp Verify

6-digit OTP verification with auto-advance, paste support and resend countdown.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add otp-verify

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { OtpVerify } from "@/components/ui/otp-verify"; <OtpVerify />

Source code

otp-verify.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxotp-verify.tsx94 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface OtpVerifyProps extends React.HTMLAttributes<HTMLDivElement> {  length?: number;  onVerify?: (code: string) => void;  /** Cooldown seconds before resending */  resendSeconds?: number;} /** 6-digit OTP verification: auto-advance, paste support, resend countdown. */export function OtpVerify({ length = 6, onVerify, resendSeconds = 30, className, ...props }: OtpVerifyProps) {  const [digits, setDigits] = React.useState<string[]>(Array(length).fill(""));  const [seconds, setSeconds] = React.useState(resendSeconds);  const refs = React.useRef<(HTMLInputElement | null)[]>([]); 

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { OtpVerify } from "@/components/ui/otp-verify"; <OtpVerify />
PropTypeDescription
lengthnumberConfigures length. (Default: 6)
onVerify(code: string) => voidCallback invoked on verify.
resendSecondsnumberCooldown seconds before resending