Email Change Guard

Email Change Guard is a copy-paste React component that stops locked out by a typo'd new email before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/email-change-guard
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsLocked out by a typo'd new email

Was this component page useful?

How do I install Email Change Guard?

pnpm dlx shadcn@latest add @bollard/email-change-guard

The files land in your project. They're yours to edit.

How do I use Email Change Guard in React?

email-change-guard-usage.tsx
import { EmailChangeGuard } from "@/components/ui/email-change-guard"

<EmailChangeGuard
  currentEmail="tushar.k@outlook.com"
  defaultValue="tushar.khadde@gmial.con"
  onRequestChange={() => wait(700)}
  onResend={() => wait(400)}
  onCancelChange={() => wait(300)}
/>

What input mistakes does Email Change Guard catch?

  • Misspelled email providers, with a one-tap fix
  • The exact point where the confirmation stops matching
  • A "new" address that is the same inbox (Gmail dots, +tags)
  • What moves with the address: sign-in, receipts and 2FA codes

What props does Email Change Guard accept?

EmailChangeGuard props
PropTypeDefault
currentEmail* (required)

The account's current, verified email.

string—
value

Controlled new-email text.

string—
defaultValue

Initial new-email text when uncontrolled.

string""
onValueChange

Called as the new email is typed or fixed.

(email: string) => void—
pendingEmail

Controlled address awaiting verification; null for none.

string | null—
onRequestChange

Sends the verification link. Only called for a clean, matching address. May return a Promise; a rejection keeps the form.

(email: string) => void | Promise<void>—
onResend

Sends the link again.

(email: string) => void | Promise<void>—
onCancelChange

Drops the pending change; the current email stays.

(email: string) => void | Promise<void>—
resendCooldown

Seconds before Resend is allowed again.

number30
domains

Provider domains to check typos against.

string[]—
delay

Pause in ms before typo and match checks run while typing.

number600
messages

Any visible string.

Partial<EmailChangeMessages>—

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Email Change Guard accessible?

  • Focus moves to the confirmation field, the fix, or the pending notice as the flow advances
  • Fields are described by their hints via aria-describedby
  • The pending state has a focusable heading

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Keep the old address active until the new one is verified, notify the old address of the change, and rate-limit resends on the server.

  • Domain typo detection uses a list of known providers; custom domains aren't checked
  • Keeping the old address active depends on your backend honouring the pending state

What expensive mistakes does Email Change Guard stop?

Locked out by a typo'd new email

Also known as

change email · update email · account settings · profile · email verification · confirm email · login email · 2fa

Field type

What dependencies does Email Change Guard require?

Email Change Guard facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameEmail Change Guard
Registry identifier@bollard/email-change-guard
Install commandnpx shadcn@latest add @bollard/email-change-guard
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Email Change Guard

What form validation mistake does Email Change Guard catch?

Email Change Guard prevents locked out by a typo'd new email. Catches typos in a new account email and keeps the old address active until the new one is verified, so nobody locks themselves out. Catches: Misspelled email providers, with a one-tap fix, The exact point where the confirmation stops matching, A "new" address that is the same inbox (Gmail dots, +tags), What moves with the address: sign-in, receipts and 2FA codes. Limitation: validate email-change-guard schemas on backend.

How do I install email-change-guard with shadcn?

Run `npx shadcn@latest add @bollard/email-change-guard`. Sources added: registry/default/email-change-guard/email-change-guard.tsx, registry/default/email-change-guard/email-change.ts. Package requirements: lucide-react.

What props customize Email Change Guard?

Email Change Guard accepts `currentEmail`, `value`, `defaultValue`, `onValueChange`, `pendingEmail`. Configures change email, update email, account settings behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of email-change-guard?

Domain typo detection uses a list of known providers; custom domains aren't checked. Keeping the old address active depends on your backend honouring the pending state Server requirement: Keep the old address active until the new one is verified, notify the old address of the change, and rate-limit resends on the server.

How does Email Change Guard meet accessibility guidelines?

Focus moves to the confirmation field, the fix, or the pending notice as the flow advances. Fields are described by their hints via aria-describedby. The pending state has a focusable heading. Minimizes errors: change email typo, update email lockout.

Which components pair with Email Change Guard?