Password Strength, animated React component
A password field with a four-segment meter that fills and recolours as you type, a rolling strength label, rules that tick themselves off, and an eye toggle that draws its own slash. Also includes Password Reveal, a password field whose reveal is a small wave: the dots turn into letters one after another, left to right, while a slash draws across the eye.
- Free
- Signup Forms
- Spring
Clicks for every character it types (and you type), then gives one soft chime the first time the password reaches Strong. The Password Reveal variant ticks softly as you use it, chimes on the key moments and whooshes on the bigger moves. Sound is off on this site until you switch it on.
Types with a key click for every character, in sync with the text. The click stays off until you switch it on.
Password Strength
Crack-time Meter
Suggested Password
Password Reveal
Like Password Strength? 301 more are in Pro.
Pro unlocks all 301 Pro components, every template and block, and everything we release next. Password Strength stays free.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| onChange | (value: string, score: number) => void | — | Called on every keystroke with the password and its score from 0 to 4. |
| accent | string | "#0071e3" | Colour of the ticked rules and the focus ring. |
| autoplay | boolean | false | Types a sample password until someone clicks in. |
| CrackTimePassword.autoplay | boolean | false | Types a few sample passwords by itself, on a loop, until the field is focused. Stays off under reduced motion and pauses off screen or in a hidden tab. |
| CrackTimePassword.onChange | (value: string, crackSeconds: number) => void | undefined | Called on every keystroke with the password and the estimated seconds a fast guessing rig needs to crack it. |
| CrackTimePassword.className | string | "" | Extra classes for the card. |
| SuggestPassword.email | string | "[email protected]" | Email shown in the read-only field above the password. |
| SuggestPassword.autoplay | boolean | false | Plays the offer, taking it, choosing your own and typing on a loop until the field is focused. Stays off under reduced motion and pauses off screen or in a hidden tab. |
| SuggestPassword.onChange | (password: string) => void | undefined | Called with the new password when the visitor types or takes the suggestion. |
| SuggestPassword.onUse | (password: string) => void | undefined | Called when the suggested password is taken. |
| SuggestPassword.onSubmit | (password: string) => void | undefined | Called with the current password when Create account is pressed. The component sends nothing anywhere. |
| SuggestPassword.className | string | "" | Extra classes for the card. |
| PasswordReveal.title | string | "Create a password" | Heading above the field. |
| PasswordReveal.hint | string | "Use 8 or more characters with a mix of letters, numbers and symbols." | Helper text shown under the field. |
| PasswordReveal.label | string | "Password" | Label of the field. |
| PasswordReveal.defaultValue | string | "Mountain-river42" | Password the field starts with. |
| PasswordReveal.submitLabel | string | "Continue" | Text on the submit button. |
| PasswordReveal.onSubmit | (password: string) => void | — | Called with the password when the form is submitted. |
| PasswordReveal.enableSound | boolean | true | Soft synthesised sounds as you use it. They also follow the site-wide sound switch. |
| PasswordReveal.volume | number | 0.6 | Sound level, 0 to 1. |
| PasswordReveal.autoplay | boolean | false | Plays a short demo by itself until the visitor touches it. Never runs under reduced motion. |
| PasswordReveal.className | string | "" | Extra classes for the outer element. |
| enableSound | boolean | true | Plays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry
Run this once per project. It writes the Nexus UI entry into
components.jsonfor you:npx shadcn@latest registry add "@nexus-labs=https://www.nexus-ui.com/api/registry/{name}"Type it exactly as shown.
{name}is filled in by the CLI with the component you ask for, so you never replace it.
- 3
Add the component
Run this from your project root. It adds the component, the helpers it imports and its npm packages.
npx shadcn@latest add @nexus-labs/password-strength
- 4
Check what was added
With a project made as in the Quick Start (a
src/folder), these files land in it:components/password-strength/crack-time-password.tsxindex.tspassword-reveal.tsxpassword-strength.tsxsuggest-password.tsx - 5
Copying by hand? Skip the registry
Instead of steps 2 and 3 you can copy the files yourself, with no registry and no API key. Step 1 still applies, so that
cn()exists. Install the packages:npm install framer-motion
Then show the source and create each file at the path it gives:
- 6
Use it in a page
Installing only adds the files. Import the component in a page and render it. The Usage tab on the preview shows a fuller example with props:
// src/app/page.tsx import { PasswordStrength } from "@/components/password-strength"; export default function Page() { return ( <main> <PasswordStrength /> </main> ); }
Like Password Strength? 301 more are in Pro.
Pro unlocks all 301 Pro components, every template and block, and everything we release next. Password Strength stays free.
Password Strength questions
Does it make sound, and how do I turn it off?
Clicks for every character it types (and you type), then gives one soft chime the first time the password reaches Strong. The Password Reveal variant ticks softly as you use it, chimes on the key moments and whooshes on the bigger moves. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.