Skip to main content
Neural UIv2.0.0Documentation
View v1 GitHub

Password

Enter a password with an optional visibility toggle and strength indicator.

Category
Forms and selection
Import
@neural-ui/core/password
Selector
neu-password
import { NeuPasswordComponent } from '@neural-ui/core/password';

Usage

Bind value to application state. toggleable adds a show/hide button; showStrength displays client-side guidance, not a security policy. Use autocomplete="new-password" for account creation or "current-password" for sign-in. Never log or echo the password in a status panel.

Examples

Try this application-owned interaction. Its event handling and initial data are included in Code.

Examples

Events: 0

Try and configure

Change the public options, try the result and inspect the updated template. Code contains the complete executable implementation.

Try and configure

Events: 0

template.html
<neu-password
  [value]="value()"
  (valueChange)="onPasswordChange($event)"
  [disabled]="false"
  [readonly]="false"
  [invalid]="false"
  [floatingLabel]="true"
  [showStrength]="true"
  [toggleable]="true"
  [autocomplete]="'new-password'"
  [hideLabel]="'Hide password'"
  [label]="'Password'"
  [showLabel]="'Show password'"
/>

State and events

Bind value to application state. toggleable adds a show/hide button; showStrength displays client-side guidance, not a security policy. Use autocomplete="new-password" for account creation or "current-password" for sign-in. Never log or echo the password in a status panel.

Accessibility and keyboard

Tab reaches the input and visibility button. Enter/Space activates the button; toggling keeps the same value.

Key
Action
Tab Move between the input and the enabled visibility button.
Enter On the visibility button, show or hide the password without changing its value.
Space On the visibility button, show or hide the password without changing its value.

API

Inputs, models and Outputs are extracted from the installed Core package. Named public types link to their definitions. Templates below include executable examples.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
autocompletestring'current-password'[autocomplete]Native browser autocomplete attribute for the input.
dirtybooleanfalse[dirty]Form state indicating that the user has changed the value.
disabledbooleanfalse[disabled]Prevents interaction with this control.
errorsreadonly ValidationError.WithOptionalFieldTree[][][errors]Validation errors supplied by the form or the application.
floatingLabelbooleanfalse[floatingLabel]Displays the label in the floating-label field style.
hiddenbooleanfalse[hidden]Hides the control according to the form state.
hideLabelstring'Hide'[hideLabel]Accessible text for the password visibility action.
inputIdstringinject(NeuIdGenerator).getId('neu-password-')Derived default[inputId]Stable control id, generated when omitted; use it to associate labels or descriptions.
invalidbooleanfalse[invalid]Displays the invalid state; it does not add a validation rule.
labelstring''[label]Visible label naming the field or action.
maxLengthnumber | undefinedundefined[maxLength]Form-supplied maximum string length. Configure the validator in your form schema.
minLengthnumber | undefinedundefined[minLength]Form-supplied minimum string length. Configure the validator in your form schema.
namestring''[name]Name of the form control.
patternreadonly RegExp[][][pattern]Form-supplied regular-expression validation constraints.
pendingbooleanfalse[pending]Form state indicating that asynchronous validation is pending.
placeholderstring''[placeholder]Text shown when the field has no selected value.
readonlybooleanfalse[readonly]Keeps the applied value visible but prevents user edits.
requiredbooleanfalse[required]Marks the field as required; use a form validator to enforce it.
showLabelstring'Show'[showLabel]Accessible text for the password visibility action.
showStrengthbooleanfalse[showStrength]Show visual password-strength guidance; it does not enforce a security policy.
toggleablebooleantrue[toggleable]Show the password visibility button.
touchedbooleanfalse[touched]Form state indicating that the control has been visited.

Models

A model supports [(property)]="signal" or the [property] and (propertyChange) pair. Choose one form, not both.

Name
Type
Default
Template binding
Description
valuestring''[(value)]Application-owned editable model value.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
touchvoid(touch)="onTouch($event)"Notifies the form that the control has been touched; not a value change.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

This component does not expose content projection or public customization templates.

Styles and tokens

Use the supported public tokens listed below. Surrounding layout belongs to your application; validate the result in light and dark modes and narrow containers.

Specific tokens

This component uses shared theme tokens rather than dedicated component hooks.

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
--neu-border Normal control and cell borders Shared by other Core consumers; scope the override. rgba(15, 23, 42, 0.08)
--neu-focus-ring Normal keyboard-focus ring Shared by other Core consumers; scope the override. 0 0 0 var(--neu-focus-ring-width) rgba(0, 122, 255, 0.15)
--neu-primary Brand color for active controls and emphasis Shared by other Core consumers; scope the override. #007aff
--neu-radius Control corner radius Shared by other Core consumers; scope the override. 8px
--neu-surface Main field, header or control surface Shared by other Core consumers; scope the override. #ffffff
--neu-surface-2 Secondary surfaces and alternating rows Shared by other Core consumers; scope the override. #f1f5f9
--neu-surface-3 Hover and raised control surfaces Shared by other Core consumers; scope the override. #e2e8f0
--neu-text Main text and inherited icon color Shared by other Core consumers; scope the override. #0f172a