Homoglyph Guard

Homoglyph Guard is a copy-paste React component that stops helps catch a spoofed username with cyrillic letters 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/homoglyph-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

StopsHelps catch a spoofed username with Cyrillic letters

Was this component page useful?

How do I install Homoglyph Guard?

pnpm dlx shadcn@latest add @bollard/homoglyph-guard

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

How do I use Homoglyph Guard in React?

homoglyph-guard-usage.tsx
import { HomoglyphGuard } from "@/components/ui/homoglyph-guard"

<HomoglyphGuard label="Payout domain" defaultValue={"p\u0430ypal.com"} protectedNames={["paypal"]} />

What input mistakes does Homoglyph Guard catch?

  • Cyrillic, Greek and other cross-script look-alikes mixed into Latin text
  • Styled Unicode letters that fold to ASCII (fullwidth, mathematical)
  • Zero-width and other invisible characters
  • Imitations of names you protect, such as paypa1 or rnicrosoft

What props does Homoglyph Guard accept?

HomoglyphGuard props
PropTypeDefault
label

Visible label.

string"Username"
hint

Helper text shown while nothing looks suspicious.

string—
value

Controlled value.

string—
defaultValue

Initial value when uncontrolled.

string""
onValueChange

Called with the new value on every change.

(value: string) => void—
protectedNames

Names this field must not imitate (your brand, staff handles). "paypa1" or "rnicrosoft" is flagged against them.

string[]NO_NAMES
warningMessage

Shown when look-alike, styled or invisible characters are found.

string"Contains characters that only look like plain letters."
impersonationMessage

Shown before a protected name the value imitates.

string"Looks like"
fixLabel

Text on the fix button, before the plain-ASCII value.

string"Use"
misreadMessage

Shown when only ambiguous plain characters (0/O, 1/l/I) are present.

string"Easy to misread when someone reads or types it:"
looksLikeLabel

Text before the character each finding imitates.

string"looks like"

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

How is Homoglyph Guard accessible?

  • Visible label tied to the input, described by the report
  • Report is a polite live region; flagged characters are <mark> elements with their Unicode name as title
  • Fix button's aria-label includes the ASCII value it will set

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: Normalise and run confusable checks on the server at registration and before display; client-side checks are easy to bypass.

  • Uses a curated look-alike table, not the full Unicode confusables.txt; rarer confusables are missed
  • Legitimate non-Latin names can be flagged as mixed-script
  • Advisory only; it does not reserve or block names

What expensive mistakes does Homoglyph Guard stop?

Helps catch a spoofed username with Cyrillic letters

Also known as

homoglyph · homograph · lookalike · unicode spoofing · username · domain · punycode · impersonation

Field type

What dependencies does Homoglyph Guard require?

Homoglyph Guard facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameHomoglyph Guard
Registry identifier@bollard/homoglyph-guard
Install commandnpx shadcn@latest add @bollard/homoglyph-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 Homoglyph Guard

What form validation mistake does Homoglyph Guard catch?

Homoglyph Guard prevents helps catch a spoofed username with Cyrillic letters. Flags look-alike, mixed-script, styled and invisible characters in usernames and domains, such as pаypal.com with a Cyrillic а. Catches: Cyrillic, Greek and other cross-script look-alikes mixed into Latin text, Styled Unicode letters that fold to ASCII (fullwidth, mathematical), Zero-width and other invisible characters, Imitations of names you protect, such as paypa1 or rnicrosoft. Limitation: validate homoglyph-guard schemas on backend.

How do I install homoglyph-guard with shadcn?

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

What props customize Homoglyph Guard?

Homoglyph Guard accepts `label`, `hint`, `value`, `defaultValue`, `onValueChange`. Configures homoglyph, homograph, lookalike behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of homoglyph-guard?

Uses a curated look-alike table, not the full Unicode confusables.txt; rarer confusables are missed. Legitimate non-Latin names can be flagged as mixed-script. Advisory only; it does not reserve or block names Server requirement: Normalise and run confusable checks on the server at registration and before display; client-side checks are easy to bypass.

How does Homoglyph Guard meet accessibility guidelines?

Visible label tied to the input, described by the report. Report is a polite live region; flagged characters are <mark> elements with their Unicode name as title. Fix button's aria-label includes the ASCII value it will set. Minimizes errors: cyrillic lookalike domain, homograph attack.

Which components pair with Homoglyph Guard?