Formify Docs

Password Strength

The passwordStrengthPlugin — live strength meter and submit gate

Password Strength

passwordStrengthPlugin scores the password live and writes { score: 0–4, label: "very-weak" | … | "strong" } to form.status.passwordStrength. With minScore, it can also block submission until the password is strong enough.

Usage

import { passwordStrengthPlugin } from "formify-js";

plugins: [passwordStrengthPlugin({ field: "password", minScore: 2 })]

// UI:
{form.status?.passwordStrength && (
  <meter value={form.status.passwordStrength.score} min={0} max={4} />
)}

Options

OptionTypeDefaultDescription
fieldstring"password"The password field to score.
minScorenumber20–4; blocks submit until the score is reached.
onStrengthChange(info) => void—Called whenever the score changes.

Things to know

  • With minScore, submit is blocked until the password reaches the required score.
  • evaluateStrength(value) is exported for use outside a form.

On this page