Components
Password Input
A password field with show and hide, and a strength meter.
Use 8 or more characters with a mix of letters, numbers and symbols.
<PasswordInput />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/password-input.jsonimport { PasswordInput } from "@/components/password-input"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
A password field with a Show/Hide button and a four-bar strength meter. The strength is also written out in words and linked to the field, so screen readers hear it too.
import { PasswordInput } from "@/components/password-input";
export function NewPassword() {
return <PasswordInput label="Password" name="password" autoComplete="new-password" />;
}The score is a simple guide: a point for 8 or more characters, then one each for mixed case, a digit and a symbol. passwordScore is exported if you want it elsewhere. Check passwords on your server too.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | The label. | |
showStrength | boolean | true | Shows the meter and the strength in words. |
className | string | Classes for the wrapper. | |
...props | input props | Every native <input> prop: name, required, onChange and so on. |
It has no animation, so reduced motion changes nothing.