Password Hint Guard

Spots the password inside a password hint or security answer, even reversed, spaced out or in leetspeak, without ever showing the password.

StopsPassword hint reveals the password

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/password-hint-guard.json

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

Usage

password-hint-guard-usage.tsx
import { PasswordHintGuard } from "@/components/ui/password-hint-guard"

<PasswordHintGuard password={password} value={hint} onValueChange={setHint} />

What it catches

  • The password written in the hint
  • Reversed, spaced-out or leetspeak versions (P@ssw0rd)
  • A long shared substring of the password
  • Admissions of reuse such as "same as my bank"

Props

PasswordHintGuard props
PropTypeDefault
password* (required)

The password chosen in the same form. Only compared, never shown or stored.

string—
value

Controlled hint or answer.

string—
defaultValue

Initial hint when uncontrolled.

string""
onValueChange

Called with the hint on every change and fix.

(value: string) => void—
kind

A public password hint, or a security-question answer. Changes the copy.

"hint" | "answer""hint"
label

Visible label. Defaults to the kind's label.

string—
minRun

Shortest shared run, in characters, that counts as giving part of the password away.

number4
onLeakChange

Called with the leak (or null) as it changes, so the form can block saving on a whole-password leak.

(leak: HintLeak | null) => void—
delay

Pause in ms before the check runs while typing. Leaving the field runs it at once.

number400
messages

Override any message or label.

Partial<typeof PASSWORD_HINT_MESSAGES>—

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

Accessibility

  • Visible label; input has aria-invalid for a severe leak and is described by a polite status
  • Severe leaks use role=alert
  • Icons are aria-hidden

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: Don't store hints next to passwords, and run the same check on the server if hints are kept.

  • Compares only with the password in the same form
  • Can't catch hints that describe the password indirectly ("my dog's name")
  • English reuse phrases

What it stops

Password hint reveals the password

Also known as

password hint · security question · recovery · signup · account security · memorable word · password reminder

Dependencies

Pairs well with