Vitral 0.2.18
Form

InputPassword

A password box with a reveal button and a strength meter.

Import

main.ts
import { InputPassword } from '@vitral/vue';

Strength meter

<script setup lang="ts">import { InputPassword, Label, StackPanel } from '@vitral/vue';import { ref } from 'vue'; const password = ref('');</script> <template>    <StackPanel spacing="0.375rem" style="min-width: 16rem">        <Label for="pw-basic">Password</Label>        <InputPassword id="pw-basic" v-model="password" autocomplete="new-password" />    </StackPanel></template>

Reveal and clear

<script setup lang="ts">import { InputPassword, Label, StackPanel } from '@vitral/vue';import { ref } from 'vue'; const password = ref('');</script> <template>    <StackPanel spacing="0.375rem" style="min-width: 16rem">        <Label for="pw-reveal">Password</Label>        <InputPassword id="pw-reveal" v-model="password" toggle-mask clearable :feedback="false" autocomplete="current-password" />    </StackPanel></template>

Sizes and states

<script setup lang="ts">import { InputPassword } from '@vitral/vue';</script> <template>    <InputPassword size="small" aria-label="Small" :feedback="false" />    <InputPassword variant="filled" aria-label="Filled" :feedback="false" />    <InputPassword invalid aria-label="Invalid" :feedback="false" />    <InputPassword disabled aria-label="Disabled" model-value="secret" /></template>

API

Read from packages/vue/src/components/InputPassword/types.ts, so it says what the component actually accepts.

Props

NameTypeDescription
feedback booleanShow a strength meter while the box has focus. Defaults to true.
toggleMask booleanAdd a button that shows the password as plain text, and back.
clearable booleanShows a clear button while there is text.
promptLabel stringShown in the meter before anything is typed.
weakLabel string—
mediumLabel string—
strongLabel string—
mediumRegex string | RegExpMet by a medium password, as a regular expression or its source.
strongRegex string | RegExpMet by a strong password, as a regular expression or its source.
size Size—
variant InputVariantDefaults to the plugin's `inputVariant`.
invalid boolean—
disabled boolean—
readonly boolean—
fluid boolean—
placement OverlayPlacement—
appendTo string`'body'` (the default), `'self'` to render in place, or a selector.

Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.

Emits

EventPayloadDescription
focus event: FocusEvent—
blur event: FocusEvent—
clear ——

Slots

NameSlot propsDescription
header —Above the meter.
footer —Below the meter: the rules a password has to follow.
content (props: { strength: 'weak' | 'medium' | 'strong' | null; label: string })Replaces the meter bar; the announced grade stays below it.
maskicon ——
unmaskicon ——