Password

v4.0

The password field lets users enter a password with characters concealed and a toggle to reveal them.

  • CSS
  • Marko
  • React
Stylized artwork of a password field.

Considerations

Performant

Forms allow users to complete fields effortlessly.

Accessible

Anyone, no matter their abilities, can complete forms.

Dynamic

Forms provide dynamic feedback so users can correct errors quickly and confidently.

Anatomy

Password field diagram with 4 elements numbered: 1. Label, 2. Value, 3. Helper text, 4. Visibility toggle.
  1. Label
  2. Value
  3. Helper text
  4. Visibility toggle

Properties

Label

Include a label unless another adjacent element already serves that purpose.

Use one of these options depending on the context: Password (default), current password, new password, or confirm password.

  • Use sentence case
  • No ending punctuation
An empty password field with a ‘Password’ label.

Value

The value is the user's password. It is obfuscated by default and can be revealed with the show/hide control.

A password field with hidden values.

Layout

There are two layouts available for password fields, stacked and floating. Stacked labels are above the field and floating labels are inside the field. A floating label animates upward on focus to make room for the value.

Two password fields; A password field with a label above, and a password field with a label inside.

Helper text

Helper text is placed below the field and informs the user of any requirements or disclaimers. It's shown persistently or on focus. Don't repeat the label.

  • Use sentence case
  • No ending punctuation, unless there's more than 1 sentence
  • Keep to one line
Helper text sits below a password field.

Error messages

Error messages appear below the field when the input doesn't meet the required format or conditions. The error message replaces any existing helper text.

Keep the tone neutral, don’t blame or scare the user. Clearly inform users the requirements so they know how to fix it.

  • Use sentence case
  • No ending punctuation
  • Avoid technical language or filler words like “please”, “sorry”, or “oops”
An error message sits below a password field.

Size

There are two sizes available: 48px and 40px. These sizes match available button sizes in case they’re inline together. Avoid mixing different sizes in a single form.

Two password fields; a password field with a 40px height sits above a password field with a 48px height.

Behavior

Overflow

Longer passwords flow beyond the visible container. While focused, the value overflows to the left to keep the cursor in view as characters are entered. When the field loses focus, the value shifts to the beginning and overflows to the right. Focusing on the field again returns to the end of the value.

An enabled state password field sits above a focused state password field with the typing cursor in view.

Privacy toggle

The privacy icon toggles between showing and hiding the characters entered to aid in situations where the password needs to be reviewed.

The icon conveys what will happen when interacted with, not the current state, so a concealed value has the show icon and a revealed value has the hide icon.

A password field with the privacy toggle ‘on’ sits above a password field with the privacy toggle ‘off’.

Screen sizes

Small

Password fields span the full width of the screen on smaller screens.

A password field spanning the full width of a mobile eBay sign in screen.

Medium and large

Password fields are aligned to the grid on larger screens up to the max width. Avoid allowing password fields to span the full screen width.

A password field spanning the full width of a modal on a larger eBay sign in screen.

Specs

A password field component is shown with specs highlighted. The space between the label and password field is 4px, padding on the left and right of content inside of the password field is 16px, padding between the value field and the trailing icon is 8px, the space between the password field and helper text is 8px, and the height of the password field is 48px.