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
| Guidance | Practice |
|---|---|
| Do | Pass localized showPasswordLabel and hidePasswordLabel. They name the toggle. |
| Do | Set autoComplete to current-password or new-password, so password managers fill the right value. |
| Don’t | Use 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
| Prop | Type | Description |
|---|---|---|
size | 'sm' | 'md' | 'lg' | sm, md or lg.Default: 'md' |
showPasswordLabel | string | The toggle name while the password is hidden. |
hidePasswordLabel | string | The toggle name while the password shows. |
Examples
A sign-in password
<Field.Root>
<Field.Label>Password</Field.Label>
<PasswordInput
autoComplete='current-password'
showPasswordLabel='Show password'
hidePasswordLabel='Hide password'
/>
</Field.Root>