Password Input

Password Input is a copy-paste React component that stops lockout caused by caps lock 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/password-input
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

StopsLockout caused by Caps Lock

Was this component page useful?

How do I install Password Input?

pnpm dlx shadcn@latest add @bollard/password-input

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

How do I use Password Input in React?

password-input-usage.tsx
import { PasswordInput } from "@/components/ui/password-input"

<PasswordInput label="Password" defaultValue="Ызкштп2026" />

What input mistakes does Password Input catch?

  • Caps Lock on
  • Non-Latin keyboard layout producing other characters
  • Pasted leading or trailing spaces, with a one-tap trim
  • Typing blind: peek to check

What props does Password Input accept?

PasswordInput props
PropTypeDefault
label

Visible label.

string"Password"
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 new value on every change.

(value: string) => void—
capsLockMessage

Warning shown while Caps Lock is on.

string"Caps Lock is on."
trimLabel

Label of the one-tap fix that trims a pasted password.

string"Trim spaces"
peekLabel

Accessible label of the peek button.

string—
peek

`hold` shows the password only while the eye is pressed (safest on a shared screen); `toggle` flips it like most sign-in forms.

"hold" | "toggle""hold"
layoutMessage

Layout warning when the pressed key is known, e.g. "Q gave й".

(script: string, pressed: string, typed: string) => React.ReactNode(script, pressed, typed) => ( <> Your keyboard is typing …
scriptMessage

Layout warning when only the letters are known (pasted or autofilled).

(script: string) => string(script) => `The password contains ${script} letters. Is …
spaceMessage

Warning for a pasted password with spaces at its `start`, `end` or `both`.

(where: "start" | "end" | "both") => string(where) => `The pasted password ${where === "both" ? "sta…

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

How is Password Input accessible?

  • Visible label; input is described by the hint and warnings
  • Peek button has an aria-label, aria-pressed and title; hold works with Space or Enter
  • Focus returns to the input after a fix

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: Rate-limit sign-in attempts on the server; these warnings only reduce honest mistakes.

  • Caps Lock state is only known after a key event
  • Doesn't check strength or breaches; see Password Policy Input

What expensive mistakes does Password Input stop?

Lockout caused by Caps Lock

Also known as

password · login · sign in · caps lock · show password · password field · auth form · signup

Field type

What dependencies does Password Input require?

Password Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component namePassword Input
Registry identifier@bollard/password-input
Install commandnpx shadcn@latest add @bollard/password-input
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 Password Input

What form validation mistake does Password Input catch?

Password Input prevents lockout caused by Caps Lock. Warns about Caps Lock, a non-Latin keyboard layout and pasted spaces as they happen, so a typo doesn't look like a wrong password. Catches: Caps Lock on, Non-Latin keyboard layout producing other characters, Pasted leading or trailing spaces, with a one-tap trim, Typing blind: peek to check. Limitation: validate password-input schemas on backend.

How do I install password-input with shadcn?

Run `npx shadcn@latest add @bollard/password-input`. Sources added: registry/default/password-input/password-input.tsx. Package requirements: lucide-react.

What props customize Password Input?

Password Input accepts `label`, `hint`, `value`, `defaultValue`, `onValueChange`. Configures password, login, sign in behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of password-input?

Caps Lock state is only known after a key event. Doesn't check strength or breaches; see Password Policy Input Server requirement: Rate-limit sign-in attempts on the server; these warnings only reduce honest mistakes.

How does Password Input meet accessibility guidelines?

Visible label; input is described by the hint and warnings. Peek button has an aria-label, aria-pressed and title; hold works with Space or Enter. Focus returns to the input after a fix. Minimizes errors: caps lock warning password, wrong password trailing space.

Which components pair with Password Input?