Skip to content

Password Input

Get Ritla UI

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

Open in Figma

Preview

Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.

PreviewCode
EnglishMirroredArabic
LTR →

Installation

  1. Add the component

    npx ritla add password-input

    Also works with shadcn: npx shadcn@latest add @ritla/password-input

  2. Dependencies it brings

    @base-ui/react@phosphor-icons/react

  3. Or 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

password-input.tsx
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.

EnglishMirroredArabic
LTR →

API reference

PasswordInput

Also takes every <input> prop except type.

PropTypeDefaultDescription
labelReactNodeNoneFigma's Label.
strength"none" | "weak" | "fair" | "strong"NoneFigma's Show strength meter and Strength. Leave it out for no meter.
strengthLabelsPartial<Record<Strength, string>>NoneYour own meter words. Default: in the page language.
required / helperText / error / disabled / readOnly…NoneAs 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.

KeyAction
TabFrom the field to the show button.
EnterSpaceShows or hides the password.

ARIA

  • The toggle is named “Show password” in both states; aria-pressed says 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.

  • R050Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
  • R051letter-spacing applied to Arabic text (breaks the connected script)
  • R042Clipped text: content wider than its box with overflow hidden and no ellipsis
  • R043Fixed-pixel-width container whose Arabic text exceeds the space