# PasswordStrength

```tsx
import { PasswordStrength } from '@tangible/ui';
```

Interactive docs and examples: [PasswordStrength in Storybook](https://design.tangible.one/?path=/docs/forms-passwordstrength--docs).

## PasswordStrength props

| Prop | Type | Default | Description |
| - | - | - | - |
| `announce?` | `boolean` | `true` | Say the score through a polite live region a second after it settles on a new value. Only the score: the hint is read with the field. Off, both are still read with the field, through `aria-describedby` on the input. Render the meter from the first paint, even with no score, so the region exists before it has anything to say. |
| `feedback?` | `string` | | What would make it stronger: "Add another word or two." |
| `labels?` | `PasswordStrengthLabels` | | |
| `score?` | `0 \| 1 \| 2 \| 3 \| 4` | | The estimate, 0 to 4. Leave it out while the field is empty, or while an estimator is still loading: the meter then shows no score and says nothing. Anything but a whole number from 0 to 4 counts as no score. |

Also accepts the standard attributes of `HTMLAttributes` (`data-*`, `aria-*`, event handlers), passed to the element it renders.

## Other exports

- `defaultPasswordStrengthLabels`: `Required<PasswordStrengthLabels>`

## Examples

Stories: Default, Scores, With Feedback, Under A Field, Custom Labels ([interactive page](https://design.tangible.one/?path=/docs/forms-passwordstrength--docs)).

## Component API tokens

Read via fallback, never declared. Set one on an ancestor to restyle every instance under it.

- `--tui-password-strength-track`
- `--tui-password-strength-weak`
- `--tui-password-strength-fair`
- `--tui-password-strength-strong`
- `--tui-password-strength-bar-size`
- `--tui-password-strength-gap`

---

Interactive version: https://design.tangible.one/?path=/docs/forms-passwordstrength--docs
