Skip to content

Password Strength

Free

Shows how strong a new password is, with a meter and a list of rules. It uses its own score, or a score you give it.

  • React 19
  • Tailwind CSS 4

Added Nov 9, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Pass the value of any input as value. A rule is { id, label, test }. The built-in scorer runs if you pass no score and no scorer.

new-password-strength.tsx

PasswordStrength

<div>
PropTypeDefaultDescription
valuestring""The password. The parts read the rules and the built-in score from it.
scorePasswordScore—A score from your own check (0 to 4, or a zxcvbn-like { score }). Wins over scorer.
scorerscorePasswordScores value. Default: scorePassword (length, kinds of characters, the rules).
rulesreadonly PasswordRule[]NO_PASSWORD_RULESThe requirements that PasswordStrengthRules lists.
labelsPasswordStrengthLabelsPASSWORD_STRENGTH_LABELSThe words for the scores 0 to 4. Default: Very weak, Weak, Fair, Good, Strong.
invalidbooleanfalseShows unmet rules as errors (red, a cross). Set it after the form tried to submit.
size"default""sm""default"sm: word and rules 12/16, icons 14. default: 14/20, icons 16. The track stays 4px.
variant"bar""segments""bar"bar: one Meter track. segments: 5 short bars, score + 1 filled.
glowboolean—A soft halo on the fill in its level color (glow, @gelatin-ui/glow). Default: false.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

PasswordStrengthMeter

<div>
PropTypeDefaultDescription
classNamestring—
glowboolean—A soft halo in the fill color (glow, @gelatin-ui/glow). Default: false.
From Base UIMeter.RootBase UI docs
aria-valuetextstring—A string value that provides a user-friendly name for aria-valuenow, the current value of the meter.
formatNumberFormatOptions—Options to format the value.
getAriaValueText—A function that returns a string value that provides a human-readable text alternative for aria-valuenow, the current value of the meter.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

PasswordStrengthLabel

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

PasswordStrengthRules

<ul>
PropTypeDefaultDescription
...props<ul> attributes—Every other attribute goes to the <ul>, with a ref.

PasswordStrengthRule

<li>
PropTypeDefaultDescription
ruleRequiredstring—The id of the rule (in the rules of the root) that this row shows.
...props<li> attributes—Every other attribute goes to the <li>, with a ref.
  • Use it next to the input for a new password.
  • Use rules with PasswordStrengthRules to list what the password must meet.
  • Use score or scorer to show the result of your own check.
  • Use variant="segments" for 5 short bars, and size="sm" for a tight form.

The meter is a Base UI Meter with a name, and the word beside it says the score in text.

Each rule shows its state with an icon and its text, so color is never alone.

labels translates the words for the scores 0 to 4.

Built with

Installs with Password Strength

Components
Meter
  1. AddedPassword Strength, with Meter.
Open the release