Skip to content

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.

Fair

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:

ts
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 ​

Getting there

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.

vue
<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 ​

PropTypeDefaultDescription
size'sm' | 'md' | 'lg''md'Control scale
togglebooleantrueShows the reveal button
strengthbooleanfalseShows the strength meter
strengthLabels[string, string, string, string]['Weak', 'Fair', 'Good', 'Strong']Meter labels, weakest first
showLabelstring'Show password'Accessible name while masked
hideLabelstring'Hide password'Accessible name while revealed
placeholderstring—Placeholder text
disabledbooleanfalseDisables the field
requiredbooleanfalseMarks it required
invalidboolean—Error styling; set automatically inside IFormField
idstringgeneratedUseful when an external ILabel targets it
unstyledboolean—Drop built-in classes
classstring—Merged with the built-in classes
ui{ root?, input?, toggle?, meter?, track?, segment?, label? }—Per-element class overrides