ComponentsForm
Password Input
A password input with show/hide toggle and optional strength meter.
Default
With Strength Meter
Sizes
Disabled
Invalid
With Field
Password must be at least 8 characters.
Installation
npx visor add password-inputThis copies two files into your project:
components/ui/password-input/password-input.tsx— the componentcomponents/ui/password-input/password-input.module.css— the styles
This also installs the input component as a dependency.
Usage
import { PasswordInput } from '@/components/ui/password-input/password-input';
<PasswordInput placeholder="Enter password" />API Reference
PasswordInputProps
| Prop | Type | Default | Description |
|---|---|---|---|
showStrength | boolean | false | Show a password strength meter below the input. |
placeholder | string | — | Placeholder text for the password field. |
disabled | boolean | false | Disables the password input. |
className | string | — | Additional CSS class names to merge onto the wrapper. |
...props | React.InputHTMLAttributes<HTMLInputElement> | — | All standard HTML input attributes are forwarded. |
The component also accepts all standard <input> HTML attributes.
Accessibility
- The show/hide toggle button has
aria-label="Show password"/"Hide password"that updates as state changes - The toggle button uses
aria-pressedto communicate the current visibility state to screen readers - Pair with a
<Label>usinghtmlFor/idfor proper labeling - When
showStrengthis enabled, the strength meter is announced viaaria-live="polite"as the user types - The input renders as
type="password"by default; toggling totype="text"reveals the value