Vitral 0.2
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
feedbackbooleanShow a strength meter while the box has focus. Defaults to true.
toggleMaskbooleanAdd a button that shows the password as plain text, and back.
clearablebooleanShows a clear button while there is text.
promptLabelstringShown in the meter before anything is typed.
weakLabelstring—
mediumLabelstring—
strongLabelstring—
mediumRegexstring | RegExpMet by a medium password, as a regular expression or its source.
strongRegexstring | RegExpMet by a strong password, as a regular expression or its source.
sizeSize—
variantInputVariantDefaults to the plugin's `inputVariant`.
invalidboolean—
disabledboolean—
readonlyboolean—
fluidboolean—
placementOverlayPlacement—
appendTostring`'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
focusevent: FocusEvent—
blurevent: 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——