Password Strength
A segmented strength meter, verdict, and requirements list for a password field.
Password Strength scores a password you already hold in state. The meter, verdict, and requirements list read that score from context, so they can sit in any order under the input.
-
- At least 8 charactersNot met
- At least one uppercase letter (A-Z)Not met
- At least one special character (!@#$%^&*)Not met
Import
Section titled “Import”import { PasswordStrength } from "@zentara-co/zenos-ui";Composition
Section titled “Composition”Pass the same string to the password input and to PasswordStrength. The root scores value and the parts render the result.
<PasswordStrength value={password}> <PasswordStrength.Label /> <PasswordStrength.Meter /> <PasswordStrength.List /></PasswordStrength>PasswordStrength├── PasswordStrength.Label├── PasswordStrength.Meter└── PasswordStrength.ListOmit children to render that same arrangement. The default policy asks for 8 characters, an uppercase letter, and a special character from !@#$%^&*.
Requirements
Section titled “Requirements”PasswordStrength.List renders one row per rule. A met rule slides its dot up and brings a check in from below. Motion-reduction preferences show the settled icon without the slide.
Custom policy
Section titled “Custom policy”Replace rules with your own { id, label, test } list. The meter stays four segments: partial matches fill one, two, or three, and the fourth fills only when every rule passes. The verdict follows those segments: Weak, Fair, Good, then Strong.
-
- At least 12 charactersNot met
- Upper and lowercase lettersNot met
- At least one numberNot met
- At least one symbol (!@#$…)Not met
- No spacesNot met
Inside a field
Section titled “Inside a field”Place the strength block after the control. Field keeps the label and input wiring. The meter is a separate reading, so it is not the field description.
PasswordStrength.Root PasswordStrength.Label PasswordStrength.Meter PasswordStrength.List
API
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Password currently held by the input. |
rules | PasswordStrengthRule[] | passwordStrengthRules | Policy of { id, label, test }. The meter always uses four segments, whatever the rule count. |
Label.placeholder | ReactNode | "-" | Shown before any rule is met. |
native props | React.HTMLAttributes<HTMLElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.
Accessibility
Section titled “Accessibility”The meter exposes aria-valuemin, aria-valuemax, aria-valuenow, and aria-valuetext. The verdict is a polite live region, so a strength change is announced without moving focus. Each requirement includes visually hidden “Met” or “Not met” text. The dot and check are decorative.
Keep the password in the input. This component only reports how that value scores against the policy.