Password Input
An input optimized for password and other sensitive-value entry. Renders a native <input type="password"> with a built-in trailing button that toggles between hidden (••••) and revealed (text) display.
Pair it with Field.* for label, description, and error wiring in forms:
Or render the control on its own:
When to use
- Password fields on login, signup, and reset flows.
- One-time tokens, recovery codes, or secrets the user needs to type accurately and may want to verify visually before submitting.
When not to use
- For values that are never sensitive: use a plain
Input. - For controls where the toggle would be confusing (e.g. masked input formatting like phone numbers).
Visibility state
The toggle is uncontrolled by default. Pass showValue to control the visibility from the outside, for example when one control reveals several password fields. Pass onValueVisibilityChange to receive the next visibility when the user clicks the built-in toggle. The eye icon animates on every visibility change, from the built-in toggle or from showValue, unless the user prefers reduced motion.
Accessibility
Always pair with a Label. The toggle is a focusable button with aria-pressed, named "Show value". The name does not change with state and does not contain the word "password", so a label query for the input matches one element. Its aria-controls points at the input's id: the id you pass, else a generated one. When disabled is set, the toggle is disabled too, so Tab skips the component. The input keeps autocomplete="current-password" / "new-password" semantics. Set autoComplete explicitly per flow.
Inside a Field.Item, pass id on Field.Item to set the input's id yourself, for example for a Playwright locator: Field.Label, the input, and the toggle's aria-controls all follow it.
Browser password managers
When revealed, the input switches to type="text". Some password managers may pause autofill in this state, which is the intended security trade-off.
Examples
With TanStack Form
Use @tanstack/react-form with zod to validate a controlled PasswordInput inside Field.Item.
API Reference
PasswordInput
The PasswordInput accepts the following props in addition to the standard HTML input attributes, except type: the toggle owns it.
One standard attribute is narrowed to a union, so a typo is a type error: autoComplete accepts the HTML autocomplete tokens.