Skip to content

PasswordStrength Plugin ​

Evaluates password strength on a 0–4 scale and validates against a minimum score threshold.

Score Algorithm ​

ScoreCriteria met
0None (empty or very short)
1Length ≥ 8
2+ Uppercase letter
3+ Digit
4+ Special character

Each criterion adds 1 point. A password with all four criteria scores 4.

Options ​

OptionTypeDefaultDescription
fieldstring(required)The field name to evaluate
messagestring'The password is not strong enough'Error message when score is below minScore
minScorenumber3Minimum required score (0–4)
onScorefunctionundefinedCalled after each evaluation: ({ field, score, valid }) => void

Playground ​

Type a password and click Validate to see the strength score. The indicator below the field updates in real time via the onScore callback.

Notes ​

  • Adds a strength validator to the specified field at plugin install time — the field must already exist in fields.
  • Score is computed each time the field is validated (not on every keystroke unless Trigger is configured).
  • Use onScore with the Trigger plugin (event: 'input') for live feedback as the user types.
  • Two PasswordStrength instances on different fields are fully independent.
  • Removing the plugin (via deregisterPlugin) removes the strength validator from the field.

Released under the MIT License.