npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lock-score

v1.1.1

Published

A React component to check password strength and display criteria validation.

Readme

🔒 lock-score: React Password Strength Meter

A lightweight, zero-dependency React component to check and visually display password strength and validation criteria. Built with TypeScript utility classes (for easy integration).

License Size Downloads

✨ Features

  • Visual Strength Bar: Displays password strength using a 4-level color-coded bar (ranging from Very Weak to Strong).
  • Detailed Criteria: Shows a clear list of criteria (e.g., minimum length, uppercase, number, special character) and whether they are met.
  • Customizable: Easily hide the criteria list using the showCriteria prop.
  • Type-Safe: Developed with TypeScript for a reliable and robust developer experience.
  • Zero Dependencies: No extra libraries required for core functionality (uses lucide-react for icons).

📦 Installation

You can install this package in your React project using npm or yarn.

npm install lock-score
# or
yarn add lock-score

🔨 Usage

⚛️ Usage (React Component)

Place the PasswordStrengthMeter component below your password input field. It will automatically calculate and display the strength based on the string provided in the password prop.

import React, { useState } from 'react';
import { PasswordStrengthMeter } from 'lock-score';

const SignupForm = () => {
  const [password, setPassword] = useState('');

  return (
    <div style={{ maxWidth: '400px', margin: 'auto', padding: '20px' }}>
      <label htmlFor="password-input" className="block text-sm font-medium text-gray-700">
        New Password
      </label>
      <input
        id="password-input"
        type="password"
        value={password}
        onChange={(e) => setPassword(e.target.value)}
        className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm p-2"
        placeholder="Enter your password"
      />
      
      {/* 1. Use the Password Strength Meter */}
      <PasswordStrengthMeter 
        password={password} 
        className="p-1 border-t border-gray-200"
      />

      {/* 2. You can hide the criteria list if needed */}
      {/* <PasswordStrengthMeter 
        password={password} 
        showCriteria={false} 
      /> */}
    </div>
  );
};

export default SignupForm;

⚙️ Component Props

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | password | string | Required | The raw password string to check for strength. | | showCriteria | boolean | true | If false, the detailed validation criteria list will be hidden. | | className | string | "" | Custom CSS classes to apply to the outer div element. |

💡 Strength Logic (Utility Functions)

The core strength calculation logic is exported as separate utility functions, which you can use independently of the React component: | Function | Description | | :--- | :--- | | calculateStrength(password) | Calculates the strength score (0 to 4) for the given password. | | checkCriteria(password) | Returns a detailed array of criteria and their fulfillment status (met: boolean). | | getStrengthText(strength) | Returns the strength rating text based on the score (e.g., "Strong"). | | getStrengthColor(strength) | Returns the corresponding Tailwind color class based on the score (e.g., "bg-green-500"). |

TypeScript

import { calculateStrength, getStrengthText } from 'lock-score';

const myPassword = "StrongPassword@123";

const score = calculateStrength(myPassword); // Output: 4
const text = getStrengthText(score); // Output: "Strong"

console.log(`Password is: ${text} (Score: ${score})`);

👤 Author & Contributor

This package is maintained and developed by Hamza Tayyab. I am passionate about creating clean, efficient, and secure frontend tools. Feel free to connect or check out my other projects!

| Platform | Link | | :--- | :--- | | 🌐 Portfolio | https://linktr.ee/hm.za | | 📧 Email | [email protected] | | 💻 GitHub | Follow me on GitHub https://github.com/hmzatayab | | 🎁 Other Packages | Check out my other open-source projects https://www.npmjs.com/~hamzatayab |

📄 License

MIT License

Copyright (c) [2025] [Hamza Tayyab]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.