Email Input

Spots misspelled email domains like gmial.con and offers a one-tap fix, never an automatic one, so sign-ups don't bounce.

StopsSignup lost to gmial.con typo

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/email-input.json

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

Usage

email-input-usage.tsx
import { EmailInput } from "@/components/ui/email-input"

<EmailInput label="Work email" defaultValue="priya.sharma@gmial.con" />

What it catches

  • Misspelled common domains (gmial.con, rediffmial.com)
  • Swapped letters, via Damerau-Levenshtein distance
  • Typos avoided altogether, with provider completions while typing (completeDomains)

Props

EmailInput props
PropTypeDefault
label

Visible label.

string"Email"
hint

Helper text shown under the field while there is nothing to warn about.

string—
value

Controlled value.

string—
defaultValue

Initial value when uncontrolled.

string""
onValueChange

Called with the cleaned value (spaces removed) on every change.

(value: string) => void—
domains

Domains to compare against. Defaults to common global and Indian providers.

string[]COMMON_EMAIL_DOMAINS
delay

Pause in ms before warnings appear while typing. Leaving the field shows them at once.

number700
typoMessage

Text shown before the suggested domain.

string—
keepLabel

Accessible label of the button that keeps the address as typed.

string—
completeDomains

Offer matching providers in a list while the domain is being typed. Default true.

booleantrue
messages

Override any text (see `EMAIL_INPUT_MESSAGES`). `typoMessage` and `keepLabel` props still win.

Partial<EmailInputMessages>—

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

Accessibility

  • Visible <label>; hints via aria-describedby
  • With completions on: role="combobox", a role="listbox", aria-activedescendant and arrow, Enter/Tab and Escape keys
  • Fix returns focus to the input; motion respects prefers-reduced-motion

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

Limitations

This is a UX guard rail. Enforce on the server: Verify ownership with a confirmation email before relying on the address.

  • Only knows the domains in its list; a typo of an unlisted domain isn't caught
  • It doesn't check that the mailbox exists

What it stops

Signup lost to gmial.con typo

Also known as

email · email field · signup · newsletter · mailcheck · domain suggestion · login · register

Field type

Dependencies

Pairs well with