shadcn examples svg logo
484

Command Palette

Search for a command to run...

Sign inGet All Access

Shadcn Verify Email Template

Verify Email is a transactional email template block that confirms a new email address with a six-digit one-time code and a one-click Verify email button. It is composed from react-email components (Html, Head, Body, Container, Section, Row, Column, Heading, Text, Button, Img, Link) and styled with the react-email Tailwind wrapper using a zinc theme, a monospace code box with wide letter spacing, an expiry note, and a mobile breakpoint. The example renders the template to static HTML on the server with @react-email/render and previews it in an iframe, ready to send through Resend or Nodemailer from a React or Next.js app, with Vuejs and Svelte versions available as well.

Pro
Verify Email Template preview
Get Unlimited Access to All Examples & Blocks.
Unlock everything with a single payment. Get lifetime access to all content. You will also receive free access to all new examples.

Code and Link in One Verification Email

The Verify Email Template is a transactional email block for confirming that a newly entered address really belongs to the user. Unlike a plain activation message it offers two paths: a six-digit one-time code displayed in a bordered box for people who verify inside the app, and a Verify email button for people who prefer a single click. It lives in the email templates collection and is the inbox half of the two step verification screens on the site.

Showing the code prominently matters on mobile, where users often read the email on the same device they are signing up on and copy the digits back into a form. The subject preview starts with the code itself, so many clients display it in the inbox list before the message is even opened.

Props and Structure

VerifyEmail accepts companyName, userName, code, url, and expiresIn. The code is rendered in a monospace font at 32px with 8px letter spacing inside a white, zinc-bordered box, followed by a This code expires in expiresIn line, and the url prop powers the button. The component is composed from Html, Head, Body, Container, Section, Row, Column, Heading, Text, Button, Img, Link, and Preview out of @react-email/components.

The Container is capped at 640px and holds the familiar three-part layout from the rest of the collection: a header row with the logo and company name, a rounded card with the Verify your email address Heading, the greeting, the code box, the button, and a security note, and a footer with a short company line, text social links, and a postal address. Because verification is an account notification, the footer states that it cannot be unsubscribed from instead of offering an Unsubscribe link.

Security Copy That Protects Users

The closing note tells readers that they can ignore the message if they did not sign up and that the company will never ask for the code, which is the standard defense against phishing attempts that reuse legitimate emails. Keep that sentence when you adapt the template, and keep the expiry short on the backend; ten minutes is the sample value in PreviewProps.

Generate the code and the tokenized url in the same server action or route handler that creates the pending account, pass them as props, and render the component with render from @react-email/components. page.tsx in this example shows that call and previews the HTML in an iframe through srcDoc, so what you see on this page is what the user receives.

Styling With the Tailwind Wrapper

theme.ts defines the palette the react-email Tailwind component compiles against: bg, bg-2, fg, fg-2, fg-3, fg-inverted, and a stroke border color, all from the Shadcn UI zinc scale, plus sans and mono font families and a mobile screen for widths up to 600px. Utilities such as border-stroke, rounded-lg, font-mono, tracking-[8px], and text-[32px] are inlined as style attributes at render time, and mobile:px-6 and mobile:py-12 are written as media queries so the card tightens on phones.

theme-fonts.tsx loads Inter at 400 and 600 with Helvetica and Arial fallbacks through the Font component. The code box falls back to the system monospace stack, which every client has, so the digits stay aligned even where web fonts are blocked.

Sending, Customizing, and Framework Versions

Send the rendered HTML with Resend, Nodemailer, or any SMTP provider. For a code-only flow, delete the Button Section and the sentence above it; for a link-only flow, remove the code box and pass an empty string as code. You can also add the requesting device or location under the greeting if your product shows that context elsewhere.

The React template shown here is matched by a Vuejs version built with vue-email on shadcn-vue and a Svelte version built with svelte-email alongside shadcn-svelte, each exposing the same five props and the same code-plus-button layout. Pro members can copy the files from the code tab or install them with the shadcn CLI command above the preview.

Frequently Asked Questions

Why does the email include both a code and a button?
The code serves users who verify inside the app or on another device, and the button serves users who open the email on the same device. Both are driven by props, so you can keep one or the other by deleting a Section.
How long should the verification code be valid?
The template only displays the expiresIn string you pass, for example 10 minutes. Enforce the actual limit on the server when the code or the token in url is checked.
Why is there no Unsubscribe link in the footer?
Verification is a transactional account notification rather than marketing, so the footer explains that it cannot be unsubscribed from. If you also send marketing mail, keep the Unsubscribe link in those templates.
Will the code stay readable if the web font does not load?
Yes. The code uses the mono font family from theme.ts, which falls back to SFMono-Regular, Menlo, Consolas, and the generic monospace stack, so the digits keep their spacing in every client.
Are there Vuejs and Svelte versions of this template?
Both exist, built with vue-email and svelte-email. They take the same companyName, userName, code, url, and expiresIn props and render the same header, code box, button, and footer.