Password

A masked text field with a show/hide button and an optional strength meter. Use it for sign-in, sign-up and password change forms.

  • vig-password
Import
import { Password } from '@vigdx/ui/password';

Basic

Bind [(value)] to a string signal. The eye button reveals the text and hides it again. Set autocomplete ( current-password or new-password ) so password managers fill the right field.

0 characters typed.

Strength meter

feedback shows a three-step meter under the field. By default a password is medium with two character classes and 6 characters, and strong with lower case, upper case and a digit and 8 characters. Pass a strength function, (value) => 'weak' | 'medium' | 'strong' , to use your own rules (the regex inputs mediumRegex / strongRegex are deprecated).

Enter a password

At least 8 characters with upper case, lower case and a digit.

Enter a password

Medium from 12 characters, strong from 20.

Label on top, hint and error

labelPosition="top" puts the label above the field. hint adds help text; errors show once the field is touched and invalid , and errorMessages replaces the built-in text for each error kind.

Case-sensitive.

Use at least 8 characters.

Toggle, disabled, read-only and sizes

[toggleMask]="false" removes the eye button. disabled also disables the button; readonly keeps the field focusable. size is sm , md (default) or lg .

Translated labels

Every text the field adds can be set per instance: promptLabel , weakLabel , mediumLabel and strongLabel for the meter, showPasswordAriaLabel for the button (its state is aria-pressed , so hidePasswordAriaLabel is deprecated). Without them the texts follow the locale set with provideVigdxUi .

Orta

Reactive Forms

Import VigValueAccessor next to the component to use formControlName , [formControl] or ngModel . Built-in validators such as Validators.minLength show the kit's messages; submit the empty form to see them.

Signal Forms

vig-password implements FormValueControl<string> , so [formField] binds value, validation and minLength / maxLength . A validate() rule compares the confirmation with the new password.

Enter a password

Valid: no

Styling hooks

Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="password"][data-part="field"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.

Scope: [data-scope="password"]

Password styling hooks
Part Element data-state
field Positioned wrapper of the label and the control. —
label The visible (or floating) label. —
input The native <input> . —
hint The vig-hint (a display: contents host; style its text part). —
disabled-reason The vig-hint with the disabled reason ( display: contents ). —
error The vig-field-error (a display: contents host; style its message part). —
toggle The show-password button ( aria-pressed ). —
meter The strength meter ( feedback ). empty, weak, medium, strong
meter-segment One of the three meter bars. —
strength The strength text under the meter. —

Accessibility

  • The control is a native <input type="password"> named by a real <label for>; it switches to type="text" while revealed.
  • The show/hide control is a <button> with a constant name ("Show password" by default) whose aria-pressed tells whether the password is shown. While revealed, the field turns off auto-capitalization, autocorrect and spell-check.
  • The strength text sits in an aria-live="polite" region, so screen readers announce changes while typing; the coloured bars are hidden from assistive technology.
  • Hint, disabled reason and error are linked through aria-describedby; a touched, invalid field sets aria-invalid="true".
  • autocomplete defaults to current-password, or new-password with feedback, so browsers and password managers can help users (WCAG 1.3.5); set it yourself for other cases. The label floats when the browser autofills the field.

API

Password

vig-password component
Password props
Name Type Default Description
autocompletestring | undefinedundefined

Native autocomplete; defaults to new-password with feedback (a password being chosen) and current-password otherwise, so password managers offer to generate or fill it.

dirtybooleanfalse
—
disabledbooleanfalse
—
disabledReasonsreadonly WithOptionalFieldTree<DisabledReason>[][]
—
errorMessagesRecord<string, string>—
—
errorsreadonly ValidationError.WithOptionalFieldTree[][]
—
feedbackbooleanfalse

Show the strength meter under the field.

hiddenbooleanfalse
—
hideLabelbooleanfalse

Visually hides the label — it still names the control for assistive tech — and drops the row reserved for it, giving a shorter control for dense toolbars such as table filters. Pair it with a placeholder.

hidePasswordAriaLabelstring | undefinedundefined

Deprecated: The reveal toggle keeps one name (`showPasswordAriaLabel`) and exposes its state through `aria-pressed`, so this label is no longer rendered. Removed in the next major.

—
hintstring | undefinedundefined
—
invalidbooleanfalse
—
label required string—
—
labelPositionLabelPosition'float'

float (default) rests the label inside the field; top sets it above a shorter field, for forms laid out with labels over their controls.

maxLengthnumber | undefinedundefined
—
mediumLabelstring | undefinedundefined
—
mediumRegex—MEDIUM_REGEX

Deprecated: Use the `strength` function input. A regex source rating `medium`; ignored when `strength` is set.

—
minLengthnumber | undefinedundefined
—
namestring''
—
pendingbooleanfalse
—
placeholderstring | undefinedundefined
—
promptLabelstring | undefinedundefined
—
readonlybooleanfalse
—
requiredbooleanfalse
—
showPasswordAriaLabelstring | undefinedundefined

Name of the reveal toggle. It stays the same in both states — the toggle's aria-pressed tells whether the password is shown.

sizeFieldSize'md'
—
strengthPasswordStrengthFn | undefinedundefined

Rates the password for the meter (template name strength). Unset, two character classes and 6+ characters are medium, lower + upper + digit and 8+ characters strong (PrimeNG's defaults).

strongLabelstring | undefinedundefined
—
strongRegex—STRONG_REGEX

Deprecated: Use the `strength` function input. A regex source rating `strong`; ignored when `strength` is set.

—
toggleMaskbooleantrue

Show the eye button that reveals the password.

touchedbooleanfalse
—
value model string''
—
weakLabelstring | undefinedundefined
—

VigValueAccessor

directive

Bridges the vigdx form fields to Reactive Forms (formControl, formControlName) and template-driven forms (ngModel). Import it next to the component; Signal Forms ([formField]) need no accessor.

VigValueAccessor methods
Signature Description
registerOnChange(fn: (value: unknown) => void): void
—
registerOnTouched(fn: () => void): void
—
setDisabledState(disabled: boolean): void
—
writeValue(value: unknown): void
—

Are you sure?