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

@slifszyc/password-validators

v1.0.4

Published

A React component for password validation with visual indicators

Readme

@slifszyc/password-validators

A React component for password validation with visual indicators with a simple API and ready-to-use.

demo

Features

  • Real-time password validation
  • Visual indicators for password strength
  • Customizable validation rules
  • TypeScript support
  • Fully tested with Jest and React Testing Library

Tech Stack

  • React 19
  • TypeScript 5.7
  • Styled Components 6
  • Jest & React Testing Library for testing
  • Storybook 8 for component documentation
  • ESLint for code linting
  • TSUP for building

Assumptions

  • The component is designed as a standalone, reusable package with a minimal API.
  • This component is part of a larger design system, following established company's design rules and component patterns.
  • While the component allows for visual customization, it maintains strict adherence to the "company's" design system principles and brand guidelines.
  • Styles are bundled using CSS-in-JS to provide a ready-to-use component without additional styling dependencies.

Future improvements

  • Enhance Storybook documentation with dedicated pages for different stakeholders showcasing different usages.
  • Replace text-based status indicators with SVG icons to ensure consistent rendering across different environments and avoid different font browser issues.
  • Implement visual regression testing using Cypress and Percy by Browserstack to prevent UI regressions and ensure visual consistency across component updates.

Installation

npm install @slifszyc/password-validators
# or
yarn add @slifszyc/password-validators

Usage

import { PasswordValidators } from '@slifszyc/password-validators'

function App() {
  return <PasswordValidators value={password} />
}

Default Validators

The component comes with the following validators enabled by default:

  • Has a number 0-9
  • Has a special char !@#$%^&*
  • Has uppercase Letter
  • Has no consecutive letters

You can override these defaults by providing your own validators prop.

Example: Using Individual Validators

import {
  PasswordValidators,
  hasNumberValidator,
  hasUppercaseValidator,
} from '@slifszyc/password-validators'

function App() {
  return (
    <PasswordValidators
      value={password}
      validators={[hasNumberValidator, hasUppercaseValidator]}
    />
  )
}

Example: Creating Custom Validators

import { PasswordValidators } from '@slifszyc/password-validators'

function App() {
  const customValidators = [
    {
      id: 'min-length',
      title: 'At least 8 characters',
      validate: (value: string) => value.length >= 8,
    },
    {
      id: 'no-spaces',
      title: 'No spaces allowed',
      validate: (value: string) => !value.includes(' '),
    },
  ]

  return <PasswordValidators value={password} validators={customValidators} />
}

Example: Customizing Validator Display

import { PasswordValidators } from '@slifszyc/password-validators'

function App() {
  return (
    <PasswordValidators
      value={password}
      renderValidator={(value, validator, index) => {
        const isValid = validator.validate(value)

        return (
          <>
            <span>{index + 1}.</span> {validator.title} (
            {isValid ? 'passed' : 'failed'})
          </>
        )
      }}
    />
  )
}

Props

| Prop | Type | Required | Description | | --------------- | ----------------------------------------------------------------------- | -------- | ---------------------------------------------------------------- | | value | string | Yes | The password value to validate | | validators | Validator[] | No | Array of validator objects that define the password requirements | | renderValidator | (value: string, validator: Validator, index: number) => React.ReactNode | No | Custom render function for each validator | | className | string | No | Custom className to apply to the root element | | style | React.CSSProperties | No | Custom styles to apply to the root element |

Validator Type

interface Validator {
  id: string
  title: string
  validate: (value: string) => boolean
}

Development

# Install dependencies
npm install

# Development
npm run storybook

# Run tests
npm test

# Build the package
npm run build

# Lint the code
npm run lint

# Publish the package
npm publish --access public

License

MIT