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

React
TypeScript
Tailwind CSS
Motion

Detected package dependencies: framer-motion, lucide-react.

@spectrumui/password-strength

Create account

Password strength: Too weak
  • 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

Login to view commandCreate a free account to access the install command

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.

PropTypeDefaultDescription
valuestring-Controlled value. Leave undefined for uncontrolled usage
defaultValuestring""Initial value when uncontrolled
onValueChange(value: string) => void-Fires with the next value on every keystroke
rulesPasswordRule[]DEFAULT_RULESRules scored by the meter and listed in the checklist
showChecklistbooleantrueRender the requirements checklist
showMeterbooleantrueRender the strength meter and label
placeholderstring"Enter password"Placeholder of the input
idstring-Id of the input element
namestring-Name of the input element
autoCompletestring"new-password"Autocomplete hint of the input
disabledbooleanfalseDisables the input and the visibility toggle
onFocusReact.FocusEventHandler<HTMLInputElement>-Forwarded to the input element
onBlurReact.FocusEventHandler<HTMLInputElement>-Forwarded to the input element
classNamestring-Additional classes merged onto the wrapper element

Examples

Custom rules and meter only

Custom rules
Password strength: Too weak
  • At least 8 characters
  • One uppercase letter
  • One number
  • One symbol
  • No spaces
Meter only
Password strength: Too weak

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.

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.