Password input
A password field with an eye that turns into eye-off, a four-step strength meter that fills and names itself, and a Caps Lock warning.
Used forSign-in formsSign-up and resetAccount settingsAPI secrets
Install with the shadcn CLI
Templates
Need the whole page?
43 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $99, and 5 are free.
Where it’s used
Sign-in forms
Show the password without losing the caret.
Sign-up and reset
A meter that tells people how strong the new password is.
Account settings
Change-password fields with a Caps Lock warning.
API secrets
Masked tokens you can peek at.
What it handles for you
Most peek buttons take focus from the field, so the keyboard closes on phones and the caret jumps. This one never takes focus.
Peek without losing your place
The toggle never takes focus, so the caret and the phone keyboard stay.
A meter that fills
Four segments fill left to right with a 50ms stagger; the word morphs through TextMorph.
Bring your own scoring
Pass a function (zxcvbn, your API) instead of the built-in length-and-variety score.
Caps Lock note
Read from the key events; it folds in under the field and away on blur.
Overview
Show/hide toggles usually swap icons, steal focus and move the caret. Here the eye turns into eye-off without leaving the field, the strength meter fills segment by segment as the word morphs from Weak to Strong, and a Caps Lock note folds in while you type with it on.
States
- hidden
- Dots, with the eye at the end.
- shown
- The eye turns into eye-off (rotate morph, 480ms); focus stays in the field.
- strength
- Segments fill (420ms each, 50ms apart) and turn red, amber or green; the word morphs.
- caps lock
- "Caps Lock is on" folds in where the hint goes.
Usage
Depends on lucide-react, installed for you by the CLI along with the keyframes it needs.
Works with
Props
| Prop | Type | Description |
|---|---|---|
| strength | boolean | (value) => 0–4default false | Show the meter; pass a function to score it yourself. |
| strengthLabels | [string, string, string, string]default ["Weak","Fair","Good","Strong"] | Words for scores 1 to 4. |
| ...Input props | InputProps | label, hint, error, size, onValueChange and every native prop. |
Accessibility and motion
- Shares field.tsx with every text control: one surface, one focus ring, one way of showing hints and errors.
- The meter is announced politely as it changes; the eye is a toggle button with aria-pressed.
- scorePassword is exported if you want the same score elsewhere.
Requirements
React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.
The CLI also installs Icon morph, Text morph, ui-interaction-motion.
Source
Registry item: /r/password-input.json


