Railbase
GPTClaude

Password

A password input with strength scoring and a generator (Zod schema included).

Updated

With show/hide + strength
const [pw, setPw] = useState("");

<PasswordInput value={pw} onInput={(e) => setPw(e.currentTarget.value)} class="w-full max-w-sm" />

A password input with strength scoring and a generator (Zod schema included).

Installation

railbase ui add password

Peer dependencies:

npm install zod

Note

railbase ui add also copies the input component — they ship alongside this component automatically.

Usage

import { PasswordInput } from "@/lib/ui/password";

<PasswordInput value={pw} onInput={(e) => setPw(e.currentTarget.value)} />
// passwordSchema, scorePassword(), generatePassword() are also exported

Anatomy

Exported parts: passwordSchema · scorePassword · generatePassword · PasswordInput