Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

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

PropTypeDefaultWhat it does
onChange—Called on every keystroke with the password and its score from 0 to 4.
accent"#0071e3"Colour of the ticked rules and the focus ring.
autoplayfalseTypes a sample password until someone clicks in.
CrackTimePassword.autoplayfalseTypes 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.onChangeundefinedCalled on every keystroke with the password and the estimated seconds a fast guessing rig needs to crack it.
CrackTimePassword.className""Extra classes for the card.
SuggestPassword.email"[email protected]"Email shown in the read-only field above the password.
SuggestPassword.autoplayfalsePlays 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.onChangeundefinedCalled with the new password when the visitor types or takes the suggestion.
SuggestPassword.onUseundefinedCalled when the suggested password is taken.
SuggestPassword.onSubmitundefinedCalled with the current password when Create account is pressed. The component sends nothing anywhere.
SuggestPassword.className""Extra classes for the card.
PasswordReveal.title"Create a password"Heading above the field.
PasswordReveal.hint"Use 8 or more characters with a mix of letters, numbers and symbols."Helper text shown under the field.
PasswordReveal.label"Password"Label of the field.
PasswordReveal.defaultValue"Mountain-river42"Password the field starts with.
PasswordReveal.submitLabel"Continue"Text on the submit button.
PasswordReveal.onSubmit—Called with the password when the form is submitted.
PasswordReveal.enableSoundtrueSoft synthesised sounds as you use it. They also follow the site-wide sound switch.
PasswordReveal.volume0.6Sound level, 0 to 1.
PasswordReveal.autoplayfalsePlays a short demo by itself until the visitor touches it. Never runs under reduced motion.
PasswordReveal.className""Extra classes for the outer element.
enableSoundtruePlays 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. 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 creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 2

    Connect the registry

    Run this once per project. It writes the Nexus UI entry into components.json for 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.

  1. 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
  2. 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.tsx
    index.ts
    password-reveal.tsx
    password-strength.tsx
    suggest-password.tsx
  3. 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:

  4. 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.