Interaction JS behaviour

Password strength

A password field with a segmented meter that changes colour and label, a rule checklist that ticks off one by one and a show/hide toggle; the scoring lives in core, with tests.

Real scenarios

The component as it is used in a product — not a specimen grid.

Create your account

Type a password: the four segments fill with the score’s colour and word, the rules tick off one by one, and the eye shows what you typed. Try “hossein2024” — it contains the name above, so it scores lower than its length suggests.

Strength:
  • At least 8 characters , not yet
  • A lowercase letter , not yet
  • An uppercase letter , not yet
  • A number , not yet
  • A symbol , not yet

Admin policy, in Persian

Twelve characters minimum: shorter passwords cap at “weak” however varied they are. The bars fill from the right.

برای حساب‌های مدیریتی

قدرت:
  • دست‌کم 12 نویسه , هنوز نه
  • یک حرف کوچک , هنوز نه
  • یک حرف بزرگ , هنوز نه
  • یک رقم , هنوز نه
  • یک نماد , هنوز نه

Just the essentials

Show only some rules — every rule still counts toward the score.

Strength:
  • At least 8 characters , not yet
  • A number , not yet

Important props

Important props
Prop Type Default What it does
wire:model string — Lands on the input itself, with every other attribute.
minLength int 8 The minimum length; anything shorter scores “weak” at most.
userInputs array [] The user’s name and email, so a guessable password is penalised.
labels array English The words: scores, rules, show, hide, strength, met, unmet.

Snippet

<x-nx::password-strength wire:model.live="password" label="گذرواژه" :user-inputs="[$name, $email]" />