OTP Verification
One-time password with resend timer
Preview
Verify Your Email
Enter the 6-digit code sent to your email
0) $el.previousElementSibling?.focus()"
class="w-12 h-12 text-center text-lg font-bold border-2 border-gray-300 dark:border-gray-600 rounded-lg focus:border-blue-500 dark:bg-gray-700 dark:text-white">
Didn't receive code?
{ window.Prism.highlightElement($refs.codeEl) }) }"
class="w-full flex items-center justify-between px-6 py-4 text-left bg-gray-50 dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors cursor-pointer">
View Code
<div x-data="{ otp: ['','','','','',''], timer: 60, canResend: false, startTimer() { this.timer = 60; this.canResend = false; const interval = setInterval(() => { this.timer--; if (this.timer === 0) { this.canResend = true; clearInterval(interval); } }, 1000); } }" x-init="startTimer()" class="max-w-md mx-auto bg-white dark:bg-gray-800 rounded-lg shadow p-8">
<div class="flex gap-2 justify-center mb-6">
<template x-for="(digit, index) in otp" :key="index">
<input type="text" maxlength="1" x-model="otp[index]" @input="if ($event.target.value && index < 5) $el.nextElementSibling?.focus()" class="w-12 h-12 text-center text-lg font-bold border-2 rounded-lg">
</template>
</div>
<button class="w-full bg-blue-600 text-white py-2 rounded-lg mb-4">Verify</button>
</div>