Skip to content
Mosaic
On this page

PasswordInput

A password input with a trailing button that shows or hides what was typed. The ref, Field wiring and input attributes such as autoComplete go to the input.

Use for

  • a password field
  • a password with a show or hide toggle

Practices

GuidancePractice
DoPass localized showPasswordLabel and hidePasswordLabel. They name the toggle.
DoSet autoComplete to current-password or new-password, so password managers fill the right value.
Don’tUse Input with type="password" and your own toggle.

API reference

PasswordInput

An InputGroup around the input and toggle. Carries data-visible while the password shows; the toggle is cl-password-input-toggle.

Slot: cl-password-input

PropTypeDescription
size'sm' | 'md' | 'lg'sm, md or lg.Default: 'md'
showPasswordLabelstringThe toggle name while the password is hidden.
hidePasswordLabelstringThe toggle name while the password shows.

Examples

A sign-in password

TSX
<Field.Root>
  <Field.Label>Password</Field.Label>
  <PasswordInput
    autoComplete='current-password'
    showPasswordLabel='Show password'
    hidePasswordLabel='Hide password'
  />
</Field.Root>