Forms
PasswordInput
A password field with a show/hide toggle. Defaults to autoComplete="current-password" and disables spell-check.
import { PasswordInput } from '@reactloom/ui';Examples
Sign-in and new password
At least 12 characters.
import { PasswordInput, Stack } from '@reactloom/ui';
export default function Example() {
return (
<Stack gap="5" style={{ width: '100%', maxWidth: 360 }}>
<PasswordInput label="Current password" />
<PasswordInput label="New password" autoComplete="new-password" description="At least 12 characters." />
</Stack>
);
}API reference
| Prop | Type | Default |
|---|---|---|
visible / defaultVisibleControlled / uncontrolled visibility. | boolean | — |
onVisibleChange | (visible: boolean) => void | — |
toggleLabelOne stable label; the button uses aria-pressed. | string | 'Show password' |
autoComplete | 'current-password' | 'new-password' | 'current-password' |
…Everything Input accepts. | InputProps | — |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
Renders Input, so its hooks apply too.
Slot class names
Add classes to inner parts with classNames (className is shorthand for root): root, label, description, control, input, section, error.
CSS variables
| Variable | Default |
|---|---|
--pl-input-radius | var(--pl-radius-md |
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-disabled] | present when on |
[data-invalid] | present when on |
[data-radius] | none · sm · md · lg · full |
[data-readonly] | present when on |
[data-size] | sm · md · lg |
Theme tokens it reads
--pl-color-bg-subtle --pl-color-bg-surface --pl-color-border-default --pl-color-border-focus --pl-color-border-input --pl-color-danger-border --pl-color-fg-default --pl-color-fg-disabled --pl-color-fg-muted --pl-color-fg-subtle --pl-control-height-lg --pl-control-height-md --pl-control-height-sm --pl-focus-ring-color --pl-focus-ring-width --pl-font-size-lg --pl-font-size-md --pl-font-size-sm --pl-radius-full --pl-radius-lg --pl-radius-md --pl-radius-none --pl-radius-sm --pl-shadow-xs
Accessibility
- The toggle is a real button with aria-pressed, so its name never changes.
| Key | Action |
|---|---|
| Tab | Move between field and toggle |
Usage guidelines
Do
- Use autoComplete="new-password" on sign-up and change-password forms.
Don’t
- Don’t block paste — password managers need it.