Blazor playground

Nova v3.37.0

Preview

Blazor

Password field

nv-fieldpassword

A form field that hides what people type, with a button to show it.

Live demo

Size

Use a password field for any secret value, such as a password, a PIN or an access key. The input hides the characters, and people can show them to check what they typed.

Anatomy

A password field with four callouts: 1 marks the label Field label, 2 the input showing the placeholder Input example, 3 the description below it, and 4 the eye button at the right end of the input.

The parts of a password field.
  1. Label (optional) says which secret to enter.
  2. Input hides the value. An icon can sit before it in the leading-input slot.
  3. Description (optional) states the requirements.
  4. Show password button switches between hidden and visible text. hidePasswordIcon removes it, and showPassword sets the visibility from code.
hidden · default
showPassword
hidePasswordIcon

States

Hover and focus styles are built in. required marks the label with an asterisk. A disabled field cannot be used, and a read-only value can still be shown and copied. Set error with an errorDescription that says how to meet the requirements, or success once they are met.

required
error
success

Validation feedback

The error state combines a red outline, warning icon and explanatory text; success uses a green outline and check icon. Your application decides when the requirements are satisfied. Keep the requirements visible in the description while the user edits.

Width

The field fills its container up to 480 px; use fluid to fill a wider container.

Themes

The design includes Spark and Ocean appearances. Use the page's theme and mode controls to compare the live examples; retain the same labels, states and validation messages in each theme.

Guidelines

  • Name the secret in the label, such as "New password" or "Current password".
  • State requirements before people type, not only in error messages.
  • Put instructions in the description, not the placeholder.
  • Allow copying and pasting, and set autocomplete to new-password or current-password so password managers can help.
  • Validate as people enter the password and give timely feedback about which requirements remain unmet.
  • Never show or log the value elsewhere on the page.
DoName the secret and state the requirements in the description.
Don'tAvoid requirements in the placeholder; they vanish as people type.

Sources