Password Field

A password input with a button that shows and hides what's typed.

Installation

  1. Add the registryOnce per project
  2. Add password-field

Usage

Password Field is an Input with an eye button at its end, which switches the input between type="password" and type="text". It takes everything Input does but type, including size and variant, and the button follows its size, its variant and its disabled state, including a disabled Field's. className and style go on the wrapper around the two, and every other prop on the input.

Set autoComplete so password managers know what to fill: current-password for signing in and new-password for signing up or changing it. Spellcheck, autocorrect and autocapitalization are off, so a shown password isn't sent to a spellchecker or changed as it's typed.

To show a secret the reader can't edit, such as an API key, use Secret Field.

Examples

New password

Use at least 12 characters.

Controlled

revealed and onRevealedChange control whether the password shows, here for two fields at once.

Sizes

Invalid

Use at least 12 characters.

Disabled

Props

PasswordField