Components

← All components

PasswordInput

src/lib/components/password-input.tsx·size (sm · md · lg) · visible (the eye) · invalid · disabled · surface · autoComplete (no Figma source — TextInput's box with a show / hide button)

Guide

tentative
  • A password the user types, where seeing it to check it is worth a button: signing in and choosing one.
  • Not for any other secret (an API key is read-only text with a copy button), and not for a field that only looks like a password.
  • Set autoComplete: current-password when signing in, new-password when choosing one. Without it a password manager guesses, and on a sign-up form it may fill the old password.
  • Keep the value when invalid — never clear it. A mistyped password is corrected, not retyped.
  • Pair it with Field: the label and the error belong there; pass invalid here too so the border matches.
  • Leave it hidden at rest. Pin visible only to show the revealed state (a console state, a specimen).
  • Say what a new password must contain in the Field hint before the user submits, not only in an error after.
  • Don't put the eye in a TextInput — its icon is never interactive. This is the component with a button in it.
  • Don't show a password by default, or remember that it was shown.
  • Don't store the value anywhere that is saved or shared: it is a secret, not screen state a console should keep.
  • No Figma source: the eye and its placement follow the design reference the log in page was laid out from.
  • Password rules (minimum length, other requirements) are a placeholder until the backend defines them.

Related: TextInput, Field, ButtonSources: src/lib/components/password-input.tsx · src/lib/components/text-input.tsx · docs/decisions/0001-component-contracts.md

size=sm empty

size=sm filled · hidden

size=sm filled · visible

size=sm invalid (value kept)

size=sm disabled

size=md empty

size=md filled · hidden

size=md filled · visible

size=md invalid (value kept)

size=md disabled

size=lg empty

size=lg filled · hidden

size=lg filled · visible

size=lg invalid (value kept)

size=lg disabled

size=lg surface=card