Skip to contentKino
Skip to Content

Password strength

How strong a new password is while it is typed, as the Meter's bar and a word, with the rules the form asks for ticked as they are met.

npx shadcn add https://kinoui.com/r/password-strength.json
Share on

Examples

KinoCreate your Kino account

Free for teams of up to five.
Password strength
x
  • 15 characters or more
  • Doesn’t use your name, your email or Kino

Default

Put it under a new password’s box, in the same Field, on a sign-up, reset or change form; never on a sign-in or current password. Its rules tick as they are met and describe the box, and userInputs marks a password built on the person’s name, email or your product’s name as weaker. Every check here is a hint: your server enforces the length and checks the password against a breach list, such as Have I Been Pwned, and says why in the Field’s error. Mask it in session replays as you mask the box, since replays record text.

sunshine1A common word with a digit
Password strength
x
harbour41Under 10 characters
Password strength
x
Harbour-41!Under 12 characters
Password strength
x
quiet harbour lanternThree words
Password strength
x

Levels

Weak, Fair, Good and Strong, from estimatePasswordScore. Length counts most, and capitals or symbols earn nothing on their own. Weak warns in red below the notch, Fair is amber, and Good and Strong are green. It is a light estimate with no dictionary: a name and a year (“Michelle1990!”) can still read Strong.

Password strength
x

Without rules

Leave out rules for the bar and the word alone. For a score that knows names, places and words, pass zxcvbn-ts’s through score.

Installation

npx shadcn@latest add https://kinoui.com/r/password-strength.json
Files
lib/reduce-motion.tslib/track.tscomponents/kino/meter.tsxlib/resize.tslib/choice.tscomponents/kino/checkbox.tsxcomponents/kino/label.tsxlib/settle.tscomponents/kino/field.tsxlib/announce.tsxlib/refs.tslib/swap.tsxcomponents/kino/password-strength.tsx
Packages
@base-ui/react

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

Props

PropTypeDefaultDescription
valuestringNoneThe password as it is typed.
rulesPasswordRule[]NoneThe rules the form asks for, each ticked while met returns true.
userInputsstring[]NoneWhat the person typed elsewhere, such as their name and email, and your product’s name. A password built on them scores lower; usesUserInputs(password, userInputs) checks the same thing for a rule.
scorenumberNoneYour own score from 0 to 4, in place of Kino’s estimate. 0 and 1 are Weak, then Fair, Good and Strong, as zxcvbn counts.
labelstring'Password strength'Names the meter, and starts what a screen reader hears.
levels[string, string, string, string]['Weak', 'Fair', 'Good', 'Strong']The words for each level, weakest first.
emptyLabelstring'Nothing typed yet'What a screen reader hears for the level while the box is empty.
metLabelstring'Done'Read after a rule that is met.

Data attributes

AttributeOnDescription
data-levelPasswordStrengthThe level, from 0 (Weak) to 3 (Strong), once something is typed.
data-meteach rulePresent while the rule is met.

Accessibility

  • The bar is a meter named by label, and its value reads as the level’s word.
  • A screen reader doesn’t hear a meter change, so a polite status says the level once typing has paused for a second, and only when it changed.
  • Inside a Field the rules describe the password box, so they are read when it is focused. A met rule ends with metLabel, so its state never rests on the tick or the colour.
  • Weak is red and sits below the notch, Fair is amber and Good and Strong are green, and the word always says the level too.
  • In forced colours the fill and the ticked rules take the system highlight.