Password Input
A password field with a button that shows and hides the text.Basic
Preview
Code
At least 12 characters.
Installation
Package
CLI (copy source)
pnpm
pnpm add @advui/corenpm
npm install @advui/coreUsage
import { Field, PasswordInput } from '@advui/core'
<Field label="Password">
<PasswordInput />
</Field>API reference
PasswordInput
Accepts every Input prop except `type` and `secureTextEntry`.| Prop | Type | Default | Description |
|---|---|---|---|
visible | boolean | — | Whether the password is shown. |
defaultVisible | boolean | false | Starting `visible` when uncontrolled. |
onVisibleChange | (visible: boolean) => void | — | Called when the button is pressed. |
toggleLabel | string | 'Show password' | Accessible name of the button. |
autoComplete | string | 'current-password' | Use 'new-password' on sign-up forms. |
size | 'sm' | 'md' | 'lg' | 'md' | As Input. |
Accessibility
- The button is a toggle with a fixed name ("Show password"), so its state is announced instead of a changing label:
aria-pressedon web, a toggle button that reads as checked on iOS and Android. - Password managers and autofill see a normal password field.
| Key | Action |
|---|---|
| Tab | Moves from the field to the show/hide button. |
| Space / Enter | Shows or hides the password (on the button). |
Platform notes
Web
The field switches between
type="password" and type="text".iOS
Uses
secureTextEntry; iOS may clear the field when typing resumes after hiding.Android
Uses
secureTextEntry.