Password Input
A password field with a hand-drawn eye toggle, a strength meter that fills segment by segment, and a live checklist.
Inputs
Playground
Tweak the props, the preview and the code follow.
Password strengthFair
Props
<PasswordInput placeholder="Password" showStrength />
Installation
npx @plumsydev/plum-ui add password-inputAlso pulls in input automatically.
Usage
import { PasswordInput } from "@/components/ui/password-input"<PasswordInput showStrength requirements />Examples
Strength & requirements
Password strength
- At least 8 characters
- Upper and lowercase letters
- A number
- A symbol
Sign up form
Use the exported getStrength() to gate the submit button.
API Reference
PasswordInput
Extends Input, except type.
| Prop | Type | Default |
|---|---|---|
showStrengthShow the four-segment strength meter. | boolean | false |
requirementsShow a checklist. Pass your own rules or `true` for the defaults. | boolean | { label: string; test: (v: string) => boolean }[] | false |
sizeHeight of the field. | "sm" | "default" | "lg" | "default" |
containerClassNameClasses for the wrapper. | string | — |
getStrength
getStrength(value, rules?) returns a score from 0 to 4.
Notes
- The toggle sets
aria-pressedand swaps its label between Show and Hide password.