Password displays strength indicator for password fields.
import { PasswordModule } from 'primeng/password';Two-way value binding is defined using ngModel.
Strength meter is displayed as a popup while a value is being entered.
Labels are translated at component level by promptLabel, weakLabel, mediumLabel and strongLabel properties. In order to apply global translations for all Password components in the application, refer to the locale
When toggleMask is present, an icon is displayed to show the value as plain text.
3 templates are included to customize the overlay. These are header, content and footer. Note that content overrides the default meter.
A floating label appears on top of the input field when focused. Visit FloatLabel documentation for more information.
IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.
When showClear is enabled, a clear icon is displayed to clear the value.
Password provides small and large sizes as alternatives to the base.
The fluid prop makes the component take up the full width of its container when set to true.
Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.
When disabled is present, the element cannot be edited and focused.
The invalid state is applied using the ā invalid property to indicate failed validation, which can be integrated with Angular Forms.
Password can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.
Value to describe the component can either be provided via label tag combined with id prop or using ariaLabelledBy, ariaLabel props. Screen reader is notified about the changes to the strength of the password using a section that has aria-live while typing.
<label for="pwd1">Password</label>
<p-password inputId="pwd1" />
<span id="pwd2">Password</span>
<p-password ariaLabelledBy="pwd2" />
<p-password ariaLabel="Password" />| Key | Function |
|---|---|
| tab | Moves focus to the input. |
| escape | Hides the strength meter if open. |