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

@aniruddha1806/password

v1.0.1

Published

A customizable React password input component with strength validation

Downloads

8

Readme

React Password Input

A comprehensive, customizable password input component for React applications with real-time validation, strength meter, and security features. Built with TypeScript and zero dependencies.

Installation

npm install @aniruddha1806/password

Features

  • 🔒 Real-time password strength validation
  • 👁️ Toggle password visibility
  • 📋 Copy to clipboard functionality
  • 📊 Visual strength meter with progress bar
  • ✅ Customizable validation requirements
  • 🎨 Fully customizable styling
  • ♿ Accessibility features with ARIA labels
  • 🔧 TypeScript support with full type definitions
  • 📱 Responsive design
  • 🪶 Zero dependencies and lightweight

Quick Start

import { PasswordInput } from '@aniruddha1806/password';

function App() {
  const handlePasswordChange = (password) => {
    console.log('Password:', password);
  };

  return (
    <div style={{ padding: '20px', maxWidth: '400px' }}>
      <PasswordInput
        label="Create Password"
        placeholder="Enter a strong password"
        onChange={handlePasswordChange}
      />
    </div>
  );
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | id | string | "password" | HTML id attribute for the input | | name | string | "password" | HTML name attribute for the input | | label | string | "Password" | Label text displayed above the input | | placeholder | string | "Enter your password" | Placeholder text for the input | | defaultValue | string | "" | Initial value of the password input | | required | boolean | true | Whether the field is required | | minLength | number | 8 | Minimum required password length | | requiredChars | object | See below | Character requirements configuration | | onChange | (value: string) => void | undefined | Callback when password changes | | className | string | "" | Additional CSS class for container | | labelClassName | string | "" | Additional CSS class for label | | inputClassName | string | "" | Additional CSS class for input | | errorClassName | string | "" | Additional CSS class for error states | | helpTextClassName | string | "" | Additional CSS class for help text | | disableCopy | boolean | false | Disable the copy to clipboard button |

requiredChars Object

| Property | Type | Default | Description | |----------|------|---------|-------------| | uppercase | boolean | true | Require at least one uppercase letter | | lowercase | boolean | true | Require at least one lowercase letter | | number | boolean | true | Require at least one number | | special | boolean | true | Require at least one special character |

Examples

Basic Usage

Simple password input with default settings:

import { PasswordInput } from '@aniruddha1806/password';

function BasicExample() {
  return (
    <div style={{ padding: '20px', maxWidth: '400px' }}>
      <PasswordInput
        label="Password"
        placeholder="Enter your password"
        onChange={(password) => console.log(password)}
      />
    </div>
  );
}

Custom Validation Requirements

Customize which character types are required:

import { PasswordInput } from '@aniruddha1806/password';

function CustomValidationExample() {
  return (
    <div style={{ padding: '20px', maxWidth: '400px' }}>
      <PasswordInput
        label="Simple Password"
        minLength={6}
        requiredChars={{
          uppercase: false,
          lowercase: true,
          number: true,
          special: false
        }}
        placeholder="At least 6 characters with numbers"
        onChange={(password) => console.log(password)}
      />
    </div>
  );
}

Custom Styled Password Input

Apply custom styling to match your design system:

import { PasswordInput } from '@aniruddha1806/password';

function CustomStyledExample() {
  return (
    <div style={{ padding: '20px', maxWidth: '500px' }}>
      <PasswordInput
        label="Create Your Password"
        placeholder="Make it strong and unique"
        className="custom-password-container"
        labelClassName="custom-label"
        inputClassName="custom-input"
        helpTextClassName="custom-help"
        onChange={(password) => console.log(password)}
      />

      <style jsx>{`
        .custom-password-container {
          margin-bottom: 24px;
        }
        
        .custom-label {
          color: #1f2937 !important;
          font-size: 16px !important;
          font-weight: 600 !important;
          margin-bottom: 8px !important;
        }
        
        .custom-input {
          padding: 16px 60px 16px 16px !important;
          border: 2px solid #e5e7eb !important;
          border-radius: 12px !important;
          font-size: 16px !important;
          background-color: #f9fafb !important;
        }
        
        .custom-input:focus {
          border-color: #8b5cf6 !important;
          box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1) !important;
          background-color: #ffffff !important;
        }
        
        .custom-help {
          background-color: #f3f4f6;
          padding: 12px;
          border-radius: 8px;
          margin-top: 8px !important;
        }
      `}</style>
    </div>
  );
}

TypeScript Usage

The component provides full TypeScript support:

import { PasswordInput, PasswordInputProps } from '@aniruddha1806/password';

interface FormData {
  email: string;
  password: string;
}

const SignupForm: React.FC = () => {
  const [formData, setFormData] = useState<FormData>({
    email: '',
    password: ''
  });

  const handlePasswordChange = (password: string): void => {
    setFormData(prev => ({ ...prev, password }));
  };

  const passwordProps: PasswordInputProps = {
    label: "Create Password",
    minLength: 10,
    requiredChars: {
      uppercase: true,
      lowercase: true,
      number: true,
      special: true
    },
    onChange: handlePasswordChange
  };

  return (
    <form>
      <PasswordInput {...passwordProps} />
    </form>
  );
};