Password Strength
Overview
A password input with an animated strength meter and requirements checklist.
This form component is intended for interfaces that need a password input with an animated strength meter and requirements checklist, authentication flows, and settings forms. Its implementation is provided as editable source so the final behavior and styling stay inside your project.
Technologies
Detected package dependencies: framer-motion, lucide-react.
Create account
- At least 8 characters
- One uppercase letter
- One number
- One symbol
Type a password — the meter fills and requirements check off as you go
Installation
Usage
import { PasswordStrengthInput } from "@/components/spectrumui/password-strength"<PasswordStrengthInput onValueChange={(value) => console.log(value)} />API Reference
PasswordStrengthInput
Renders a password input with a visibility toggle, a strength meter announced via a polite live region, and a requirements checklist. Pass value to control it from outside, or defaultValue to let it manage its own state. Strength is scored against rules, an array of PasswordRule objects of the shape { label: string; test: (value: string) => boolean }. The exported DEFAULT_RULES check for at least 8 characters, one uppercase letter, one number and one symbol.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | - | Controlled value. Leave undefined for uncontrolled usage |
defaultValue | string | "" | Initial value when uncontrolled |
onValueChange | (value: string) => void | - | Fires with the next value on every keystroke |
rules | PasswordRule[] | DEFAULT_RULES | Rules scored by the meter and listed in the checklist |
showChecklist | boolean | true | Render the requirements checklist |
showMeter | boolean | true | Render the strength meter and label |
placeholder | string | "Enter password" | Placeholder of the input |
id | string | - | Id of the input element |
name | string | - | Name of the input element |
autoComplete | string | "new-password" | Autocomplete hint of the input |
disabled | boolean | false | Disables the input and the visibility toggle |
onFocus | React.FocusEventHandler<HTMLInputElement> | - | Forwarded to the input element |
onBlur | React.FocusEventHandler<HTMLInputElement> | - | Forwarded to the input element |
className | string | - | Additional classes merged onto the wrapper element |
Examples
Custom rules and meter only
- At least 8 characters
- One uppercase letter
- One number
- One symbol
- No spaces
Use cases
- interfaces that need a password input with an animated strength meter and requirements checklist
- authentication flows
- settings forms
Features
- Copy-paste source that remains in your repository
- TypeScript source included with the component
- Tailwind CSS classes editable in the component source
- Animation implemented with Motion
- Responsive Tailwind variants present in the source
- Reduced-motion handling present in the source
Accessibility
- The source includes ARIA attributes or roles; preserve them when customizing the component.
- The source checks reduced-motion preferences or includes motion-reduce styles.
- Test focus order, keyboard operation, labels, contrast, and screen-reader output in the final application context.
Customization
- Edit the Tailwind utility classes in the copied source to match your spacing, color, and typography tokens.
- Use the documented className surface for local layout adjustments, then edit the source for structural changes.
- Adjust Motion transitions in the source and keep the reduced-motion behavior aligned with the final interaction.
Related components
Topic guides
See how this component fits into broader interface patterns, implementation decisions, and working examples.
Password Strength FAQ
Is Password Strength free to use in commercial projects?
Yes. The public Password Strength source is available under the Apache License 2.0, including for commercial use, subject to the LICENSE terms.
How do I install Password Strength?
Run npx shadcn@latest add @spectrumui/password-strength. The page also exposes the source for manual installation.
Does Password Strength require Motion?
Yes. Motion usage was detected in the documented source or registry dependencies for Password Strength.
Does Password Strength use shadcn/ui or Radix UI?
No shadcn/ui or Radix UI dependency was detected in the documented Password Strength source.
Can I use Password Strength in Next.js?
The documented React source is used in this Next.js application. Keep its use client directive when copying it into the App Router. Install the detected dependencies and verify any application-specific data or image configuration.
What accessibility checks should I run for Password Strength?
The source includes ARIA markup, reduced-motion handling. Test the finished interface with keyboard and screen-reader workflows.