Password input
A password field with a show / hide toggle.
{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}
A password field with a show / hide toggle.
Import
import { PasswordInput } from "@ir/ui";Props
| Prop | Type | Required | What it does |
|---|---|---|---|
showLabel | string | Accessible names for the eye button, e.g. to localise. |
Do and don't
Use PasswordInput, which has the eye built in.
Don't — Ship a password field without a way to see what was typed.
Typing blind is the main cause of failed sign-ins and mistyped new passwords. Seeing it once fixes both.
Set autoComplete='new-password' there.
Don't — Leave autocomplete as current-password on a 'choose a password' field.
It is the signal password managers use to offer a strong generated password instead of filling an old one.
Let people reveal what they typed.
Don't — Add a 'Confirm password' field.
Retyping a password twice checks memory, not accuracy. The eye checks accuracy directly.
Accessibility
- The eye is a button with aria-pressed and a label that says what it will do: 'Show password' / 'Hide password'.
- Autocorrect, autocapitalise and spellcheck are off, so a revealed password is not 'corrected'.
Where it is drawn
Figma — structure from figma, measurements from figma.