Staaarter

Email Verification Code

A full-height email verification screen: a segmented 6-digit code input that auto-advances focus as you type and moves back on backspace, a Verify button disabled until all 6 digits are filled, and a live countdown that swaps into a Resend code button once it reaches zero.

By Staaarter Team
Auth
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/email-verification-code.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/auth/auth3.tsx instead.

Usage

The file also exports auth3Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Auth3, auth3Demo } from "@/components/blocks/auth/auth3";

export default function Page() {
  return <Auth3 {...auth3Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Check your email"Screen heading.
descriptionstring"We sent a 6-digit verification code to your email address. Enter it below to continue."Short description shown under the heading.
emailstringnoneEmail address the code was supposedly sent to, appended to the description when set.
resendSecondsnumber30Seconds the resend countdown starts from.
classNamestringnoneExtra classes for the outer section element.

Behavior notes

  • The 6 code inputs are real client-side state: typing a digit auto-advances focus to the next box, and backspace on an empty box moves focus back to the previous one.
  • The Verify button's disabled state is derived from real state too, it only becomes clickable once all 6 boxes are filled, though clicking it does not verify anything against a real backend.
  • The countdown is a genuine setInterval-driven timer (cleaned up on unmount) starting from resendSeconds; once it reaches 0 the text is replaced with a Resend code button that restarts the same local timer, no email is actually sent or resent.