OTP Verification

A user-friendly OTP verification component with auto-focus, paste detection, and resend timer

Zezo OTP Verify Component

Logo

Verify Your Number

Code sent to +91 8797653552

Resend code in 120s

📦 Installation

pnpm dlx shadcn@latest add https://zezo-ui.vercel.app/r/zezo-auth.json

💡 Usage Example

import OtpVerify from "@/components/zezo/auth/OtpInput";

<OtpVerify
  countryCode="+91"
  phoneNumber="9876543210"
  onSubmit={(otp) => {
    console.log("OTP:", otp);
    // Verify OTP with your API
  }}
  isLoading={false}
  error=""
/>

📘 Props

PropTypeRequiredDescription
countryCodestringYesCountry code to display (e.g. "+91")
phoneNumberstringYesPhone number displayed in subtitle
onSubmit(otp: string) => voidOptionalCallback function called when OTP is submitted (all fields filled)
isLoadingbooleanOptionalLoading state for verify button (default: false)
goBack() => voidOptionalCallback for back navigation (shows back button)
errorstringOptionalError message displayed in red below OTP fields
otpLengthnumberOptionalNumber of OTP digits (default: 4)
resetTimenumberOptionalCountdown time in seconds before resend enabled (default: 120)
titlestringOptionalMain heading text (default: "Verify Your Number")
subtitlestringOptionalSubtitle text (default: "Code sent to [countryCode] [phoneNumber]")
logoUrlstringOptionalLogo image URL displayed at top (has default)
backgroundImageUrlstringOptionalRight side background image URL (hidden on mobile, has default)
backgroundColorstringOptionalCustom background color (overrides theme)

✨ Features

🔢 OTP Input

Multi-digit OTP input with separate fields

⚡ Auto-Focus

Automatically moves to next field on input

📋 Paste Detection

Supports pasting OTP from clipboard

⌨️ Keyboard Navigation

Backspace moves to previous field

⏱️ Resend Timer

Countdown timer before resend is enabled

🔄 Resend Code

Resend button appears after timer expires

🔙 Back Navigation

Optional back button with callback

🎨 Customizable Branding

Logo, title, subtitle, and background image

🌓 Dark Mode

Automatic theme support

⚡ Loading States

Built-in loading and error handling

📱 Responsive

Mobile-first responsive design

🎯 Theme Colors

Integrates with dynamic theme colors