Password Input
A password field with a show / hide toggle, and an optional strength meter for new passwords.
Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
Installation
Add the component
npx ritla add password-inputAlso works with shadcn:
npx shadcn@latest add @ritla/password-inputDependencies it brings
@base-ui/react@phosphor-icons/reactOr copy by hand
Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.
Usage
import { PasswordInput } from "@/components/ui/password-input";<PasswordInput label="Password" autoComplete="current-password" /><PasswordInput label="New password" autoComplete="new-password" strength={score(value)} />Examples
Strength and states
strength: none, weak, fair, strong. Ritla UI doesn't score passwords: pass your estimator's result. A sign-in field has no meter.
API reference
PasswordInput
Also takes every <input> prop except type.
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | None | Figma's Label. |
strength | "none" | "weak" | "fair" | "strong" | None | Figma's Show strength meter and Strength. Leave it out for no meter. |
strengthLabels | Partial<Record<Strength, string>> | None | Your own meter words. Default: in the page language. |
required / helperText / error / disabled / readOnly | … | None | As on Input Field. |
Accessibility
Keyboard
Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.
| Key | Action |
|---|---|
| Tab | From the field to the show button. |
| EnterSpace | Shows or hides the password. |
ARIA
- The toggle is named “Show password” in both states;
aria-pressedsays whether the password shows. - The meter is
role="meter", named “Password strength”, with a text value (“Fair”). - Use
autoComplete="current-password"to sign in and"new-password"to sign up, so password managers work.
Arabic and RTL notes
Mirrors
- The show button sits at the end of the field (the left).
- The meter fills from the inline start (the right), its word at the end.
Does not mirror
- The eye icon doesn't mirror.
- Numerals
- No numbers in the field itself.
- Arabic typography
- The meter word is
label-12, in the page language.
Checks it passes
The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.
- Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
- letter-spacing applied to Arabic text (breaks the connected script)
- Clipped text: content wider than its box with overflow hidden and no ellipsis
- Fixed-pixel-width container whose Arabic text exceeds the space