Skip to content
VenusUI
Get started

Password Input

A password field with a show/hide toggle and an optional strength meter.

Preview

Installation

npx shadcn@latest add @venusui/password-input

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/password-input.tsx

Usage

The code behind the preview above.

password-input-demo.tsx

import { PasswordInput } from "@/components/ui/password-input"

export default function PasswordInputDemo() {
  return (
    <div className="w-full max-w-sm space-y-2">
      <label htmlFor="new-password" className="text-sm font-medium">
        New password
      </label>
      <PasswordInput id="new-password" autoComplete="new-password" showStrength />
    </div>
  )
}

API reference

PropTypeDefaultDescription
showStrengthbooleanfalseShow a four-step meter and a hint under the field.

All <input> props except type. Works controlled (value + onChange) or uncontrolled.

Requirements

  • lucide-react for the eye icons, React 19 and Tailwind CSS v4.

Customization

  • scorePassword is exported. Replace it with your own rules (or a library such as zxcvbn) to match your policy.
  • Use autoComplete="new-password" on sign-up and "current-password" on sign-in so password managers help.

Accessibility

  • The eye button is a toggle labelled “Show password” with aria-pressed.
  • The strength hint is linked with aria-describedby and announced politely as it changes.
  • The meter colors are backed by text, so strength isn’t conveyed by color alone.

Troubleshooting

The meter says Strong but the server rejects the password.
The meter is only a guide. Always validate passwords on the server against your real policy.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A text field whose label sits inside and floats above on focus or when filled.

Loading preview

A number field with minus and plus buttons, clamped to a range.

Loading preview

OTP Input

Inputs

One-time code entry in separate boxes with paste, autofill and keyboard navigation.