The Password Input wraps a standard input with a visibility toggle, allowing users to reveal or conceal their password.
Basic Usage
import { PwdInput } from "@paramanu/forms-react"
export default function App() {
return <PwdInput placeholder="Enter password..." />
<div class="pm-pwd-input pm-pwd-input--outline pm-pwd-input--md">
<input class="pm-input pm-input--outline pm-input--md" type="password" placeholder="Enter password..." />
<button type="button" class="pm-pwd-input__toggle" aria-label="Show password">Show</button>
Variants
import { PwdInput } from "@paramanu/forms-react"
export default function App() {
<PwdInput variant="outline" placeholder="Outline" />
<PwdInput variant="filled" placeholder="Filled" />
<div class="pm-pwd-input pm-pwd-input--filled pm-pwd-input--md">
<input class="pm-input pm-input--filled pm-input--md" type="password" placeholder="Filled" />
<button type="button" class="pm-pwd-input__toggle" aria-label="Show password">Show</button>
Accessibility
| Feature | Detail |
|---|
| Toggle button | aria-label updates between “Show password” and “Hide password” |
aria-invalid | Applied when invalid is true |
| Keyboard | Toggle button is focusable via Tab |
Best Practices
- Always pair with a label for the password field.
- Use the visibility toggle to help users verify their input.
Props
| Prop | Type | Default | Description |
|---|
variant | "outline" | "filled" | "unstyled" | "outline" | Visual variant |
size | "xs" | "sm" | "md" | "lg" | "md" | Input size |
invalid | boolean | false | Invalid state |
disabled | boolean | false | Disabled state |
fullWidth | boolean | false | Full-width layout |
CSS Classes
| Class | Description |
|---|
pm-pwd-input | Wrapper base class |
pm-pwd-input__toggle | Toggle button |
pm-pwd-input--visible | Visible state |