WlPasswordInput
Indicators
Full example
<div class="wl-stack" data-space="md">
<WlPasswordInput
v-model="value"
aria-label="Password"
autocomplete="new-password"
/>
</div>Size and density
Full example
<div class="wl-stack" data-space="md">
<WlPasswordInput
v-model="value"
aria-label="Password"
autocomplete="new-password"
/>
</div>Password visibility and validation
Sizes and compact density, visibility toggle, application-side length validation and a disabled field.
Sizes and password visibility
The Show password button changes only visibility. The model value stays the same.
Application validation and disabled
Characters entered: 0. The password itself is not shown in messages.
Full example
<script setup lang="ts">
import { WlButton, WlField, WlPasswordInput } from "legato-ui";
import { ref } from "vue";
const password = ref("");
const touched = ref(false);
</script>
<template>
<div class="wl-stack" data-space="xl" data-input-example="WlPasswordInput">
<section class="wl-stack" data-space="md">
<h3 class="wl-text-subheading">{{ "Sizes and password visibility" }}</h3>
<div class="wl-grid" data-space="lg">
<WlField
v-for="size in ['sm', 'md', 'lg'] as const"
:id="`docs-password-${size}`"
:key="size"
v-slot="{ id }"
:label="`${'Password, '}${size}`"
>
<WlPasswordInput
:id="id"
v-model="password"
:size="size"
autocomplete="new-password"
/>
</WlField>
<WlField id="docs-password-compact" v-slot="{ id }" label="Compact password input"><WlPasswordInput
:id="id"
v-model="password"
density="compact"
autocomplete="new-password"
/></WlField>
</div>
<p class="wl-text-small wl-text-muted">{{ "The Show password button changes only visibility. The model value stays the same." }}</p>
</section>
<section class="wl-stack" data-space="md">
<h3 class="wl-text-subheading">{{ "Application validation and disabled" }}</h3>
<div class="wl-grid" data-space="lg">
<WlField
id="docs-password-validation"
v-slot="{ id, ariaDescribedby, invalid }"
label="Password with validation"
:error="touched && password.length < 8 ? 'At least 8 characters required.' : undefined"
hint="This is an example rule, not built-in password strength validation."
>
<WlPasswordInput
:id="id"
v-model="password"
:invalid="invalid"
:aria-describedby="ariaDescribedby"
autocomplete="new-password"
@blur="touched = true"
/>
</WlField>
<WlField id="docs-password-disabled" v-slot="{ id }" label="Disabled password">
<WlPasswordInput :id="id" model-value="Example-secret" disabled />
</WlField>
</div>
<div class="wl-inline" data-space="sm">
<WlButton size="sm" @click="touched = true">{{ "Check length" }}</WlButton>
<WlButton size="sm" @click="password = ''; touched = false">{{ "Clear password" }}</WlButton>
</div>
<p class="wl-text-small" role="status">{{
"Characters entered:"
}} {{
password.length
}}{{
". The password itself is not shown in messages."
}}</p>
</section>
</div>
</template>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
v-model: stringPassword value (default "").
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
size | WlSizeSm | "md" | Field size. |
density | WlDensity | "default" | Density. |
invalid | boolean | false | Error state. |
disabled | boolean | false | Disables the field. |
placeholder | string | Not set | Placeholder; falls back to WlConfig.locale.password (Password in English). |
ariaLabel | string | Not set | Input aria-label. |
strength | number | Not set | Consumer-provided password-strength status. |
strengthLabel | string | Not set | Readable description of the password-strength status. |
pt | WlPt< | Not set | Attributes and callbacks for the component's documented pass-through sections. |
Events
| Event | Payload | When emitted |
|---|---|---|
update:modelValue | string | Emitted when the component requests a model change; the payload is the next value. |
Slots
No public slots.
Pass-through: pt
Sections WlPasswordInput are listed below. Attributes merge in this order: createWlPt() WlConfig.ptpt instance. Class and style merge; the last supplied value takes priority for other attributes.
| Section | DOM | Purpose |
|---|---|---|
root | div.wl-input-wrap | Main element of the component. |
toggleButton | button.wl-input-wrap__btn | Button that switches password visibility. |
toggleIcon | span | Decorative password-visibility icon. |
strength | meter.wl-password-strength | Decorative password-strength indicator. |
input | input | Native input that receives focus and control attributes. |
Sections refer to the component DOM. Dotted names identify a configuration group and its section; composite parts use their own pt groups. Global and local attributes merge, with class and style added together.
Keyboard and accessibility
- The native input needs a label through id/for or ariaLabel; the consumer sets autocomplete for the form scenario.
- The visibility button is keyboard-accessible, updates aria-pressed, and switches between “Show password” and “Hide password”.
- Toggling visibility preserves the string model. Do not display passwords in status messages, logs or errors.
- The application validates password strength. For errors, pass invalid and associated text; to disable the input, use disabled.
Keyboard and application responsibilities
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesChanges are emitted through v-model. After selection, cancellation and reset, labels and states must remain clear.
In your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.