PasswordInput
A password field with the show/hide eye.
$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/password-input.jsonStates
When to use
- Every password field: Masuk ("Password", current-password), Undangan ("Password baru", "Ulangi password", new-password), later "Ubah password".
When not to use
- Any other secret that is not typed by the user (a PIN shown once) → plain text, not this field.
- A one-time code → Input with inputMode="numeric" and autoComplete="one-time-code".
Do and don't
Set autoComplete"current-password" to sign in, "new-password" for both fields of a new password, so a password manager fills and saves the right thing.
A placeholder like "Masukkan password"The label already says what to type. Placeholders show example values only (docs/writing.md).
Installation
Add PasswordInput with the shadcn CLI (your project needs a components.json and the MaHR theme: https://mahrdesign.faizintifada.com/r/theme.json), or copy the files by hand.
API
import { PasswordInput } from "@/components/ui/password-input"| Prop | Type | Default | Description |
|---|---|---|---|
…Input props | InputProps (no type, no end) | – | value, onChange, id, name, aria-invalid, aria-describedby, size, disabled. |
autoComplete | string | "current-password" | "new-password" on a page that creates one. |
shown · defaultShown · onShownChange | boolean · boolean · (shown) => void | – | Controlled or uncontrolled eye. |
resetKey | number | string | – | Change it (e.g. the submit count) to hide the value again. |