Password Strength
- Stable
- WCAG 2.2 evidence
- RTL
Shows how strong a new password is: four bars and a text label under the password field. Built
on React Aria Meter: role="meter" with aria-valuenow 0 to 4 and the label as aria-valuetext (WCAG 4.1.2). The level
is said in words and by the number of filled bars, never by colour alone (1.4.1). Changes are announced politely once typing
pauses (4.1.3); the first render is not announced. Consumer duties: computing strength; label wording that matches your policy; putting the component right after the password
field. Not for sign-in forms.
import { PasswordStrength } from "@nexera-ui/react";- 3
- examples
- 8
- props
- 1
- live controls
- 1
- platform
- 6
- WCAG criteria
- 2
- blocks use it
Try every prop. Copy the code.
Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.
import { PasswordStrength } from "@nexera-ui/react";
<PasswordStrength />Examples 2
The same examples as Storybook, rendered live. Open Code to copy one.
With password field
Under a new-password field: the level is announced politely once typing pauses.
import { useState } from "react";
import { Input, PasswordStrength } from "@nexera-ui/react";
function rate(password: string): PasswordStrengthLevel {
if (password.length === 0) return "empty";
if (password.length < 6) return "weak";
if (password.length < 9) return "fair";
if (password.length < 12) return "good";
return "strong";
}
export function WithPasswordField() {
const [password, setPassword] = useState("");
return (
<div className="flex flex-col gap-2">
<Input
label="New password"
type="password"
autoComplete="new-password"
value={password}
onChange={setPassword}
/>
<PasswordStrength strength={rate(password)} />
</div>
);
}
Long label and right to left
Labels wrap instead of truncating, and the bars fill from the inline start in right-to-left layouts.
import { PasswordStrength } from "@nexera-ui/react";
export function LongLabelAndRightToLeft() {
return (
<div className="flex flex-col gap-6">
<PasswordStrength
strength="fair"
labels={{
fair: "Fair password: add a number, a symbol and a few more characters to make it stronger",
}}
/>
<div dir="rtl" lang="ar">
<PasswordStrength
strength="good"
aria-label="قوة كلمة المرور"
labels={{ good: "كلمة مرور جيدة" }}
/>
</div>
</div>
);
}
Props 8
Press "Try it" on a card to load that prop into the playground.
8 props shown
strengthNexera"empty" | "weak" | "fair" | "good" | "strong"Level to show. Compute it in your app from your password policy (length, character classes, breach lists); the component only displays it. Four bars fill one by one and the label states the level in words.
labelsNexeraPartial<Record<PasswordStrengthLevel, string>>Text of the label for each level, shown under the bars and used as the meter's aria-valuetext. Defaults to
the Figma texts: "Use 12 or more characters" (Empty; match it to your policy), "Weak password", "Fair password",
"Good password", "Strong password". Translate them.
aria-labelNexerastringAccessible name of the meter. Figma shows no visible name; pass aria-labelledby to use visible text instead (the default
name is then dropped). Translate it.
classNameNexerastringExtra classes for the root, merged last so they win over the defaults.
styleNexeraCSSPropertiesInline style of the root.
idReact AriastringThe element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
aria-labelledbyReact AriastringIdentifies the element (or elements) that labels the current element.
aria-describedbyReact AriastringIdentifies the element (or elements) that describes the object.
* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.
Accessible by default.
Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.
WCAG 2.2 evidence
4 direct · 2 supporting- 1.3.1Info and RelationshipsLevel A · tested directly
- 1.4.1Use of ColorLevel A · tested directly
- 1.4.10ReflowLevel AA · supporting test
- 1.4.12Text SpacingLevel AA · supporting test
- 4.1.2Name, Role, ValueLevel A · tested directly
- 4.1.3Status MessagesLevel AA · tested directly
Fits any width.
Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.
Styling hooks
Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.
<PasswordStrength className="shadow-sm" />Used in blocks
Related components
- CalendarDayOne day of a {@link CalendarMonth } grid, built on React Aria `CalendarCell`: a `gridcell` whose button is named by the full, localised date ("Wednesday, October 14, 2026"), with `aria-selected`, `aria-disabled` and the "today" and range descriptions read by screen readers (WCAG 1.3.1, 4.1.2).
- CalendarMonthA month calendar for picking a date or a date range: header with previous / next buttons and the localised month name, weekday row, and six weeks of `CalendarDay`s.
- CheckboxThe bare 18 px checkbox: one independent yes/no choice applied on submit, or a row selector in a table, list or tree.
- CheckboxCardA large checkbox option with an icon, a title and a description, for a few options that need explanation (notification channels, benefits).
- CheckboxFieldA checkbox with a label and optional helper text: the box (the same element as `Checkbox`) followed by the label and description, applied on submit.
- ColorInputA hex colour field with a swatch and a picker popover.
- ColorPickerPicks a colour.
- ColorTokenCardDocumentation card for one colour token: a 96 px colour sample with an "Aa" text sample, then the name, token path, hex value and contrast note as text.