Inputs
PasswordStrength
A 3-step strength meter with a polite text label for password fields.
<script>
import { PasswordStrength, TextField } from "@codeatlasdev/ui";
let password = $state("");
</script>
<TextField label="Password" type="password" bind:value={password} />
<PasswordStrength value={password} />
The label (“Weak”, “Fair”, “Strong”, from the i18n catalog) is a polite live region; the bar is decoration, so colour is never the only signal. A hint, not a policy: enforce rules on the server. passwordScore(value) is the pure function behind it (0 empty to 3 strong); pass score for your own rule.
Sign-up field
Password strength:Enter a password
Reference #841 · Pick in the gallery
Code
Your own rule
`score` and `labels` replace the built-in estimate and the catalog text.
Password strength:Type a passphrase
Reference #842 · Pick in the gallery
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | '' | The password being typed. Only read to compute the score. |
score | (value: string) => 0 | 1 | 2 | 3 | passwordScore | Replaces the built-in estimate. 0 is empty, 3 is strong. |
labels | Partial<{ empty, weak, fair, strong }> | catalog | Label text; unset keys use the locale. |
id | string | undefined | For a field's `aria-describedby`. |
class | string | '' | Extra class names. |