Forms
IPasswordInput
A masked field with a show/hide toggle and an optional strength meter. It composes IInput, so sizes, states and form wiring behave the same way.
The toggle is a button in the trailing slot, reachable by keyboard, and it announces its state.
Strength meter
strength adds a four-segment meter under the field. Type into it to see it move.
The meter scores what has been typed and nothing else. Enforce your actual policy in the validator on your IForm, where it can refuse the submit:
const schema = z.object({
password: z.string()
.min(12, 'Use at least 12 characters.')
.refine(notBreached, 'That password has appeared in a data breach.'),
})strengthLabels renames the four steps, weakest first.
Custom strength labels
Without the toggle
The toggle only ever reveals what is being typed now, so leaving it on is usually the friendlier choice.
Sizes
In a form
Inside an IFormField the id, invalid state and aria-describedby are wired for you, exactly as for a plain input.
<IFormField name="password" label="Password" required>
<IPasswordInput v-model="state.password" strength />
</IFormField>Set autocomplete so password managers recognise the field: new-password on a sign-up, current-password on a sign-in. It falls through to the input.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
size | 'sm' | 'md' | 'lg' | 'md' | Control scale |
toggle | boolean | true | Shows the reveal button |
strength | boolean | false | Shows the strength meter |
strengthLabels | [string, string, string, string] | ['Weak', 'Fair', 'Good', 'Strong'] | Meter labels, weakest first |
showLabel | string | 'Show password' | Accessible name while masked |
hideLabel | string | 'Hide password' | Accessible name while revealed |
placeholder | string | — | Placeholder text |
disabled | boolean | false | Disables the field |
required | boolean | false | Marks it required |
invalid | boolean | — | Error styling; set automatically inside IFormField |
id | string | generated | Useful when an external ILabel targets it |
unstyled | boolean | — | Drop built-in classes |
class | string | — | Merged with the built-in classes |
ui | { root?, input?, toggle?, meter?, track?, segment?, label? } | — | Per-slot class overrides |