1.0.1 • Published 8 months ago

@xho/react-password-meter v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

React Password Strength Meter

A customizable, lightweight password strength meter component for React applications.

Features

šŸŽØ Multiple built-in themes (Classic, Emoji, Minimal)
šŸ’Ŗ Comprehensive strength calculation
šŸ›  Fully customizable themes and scoring
šŸ“¦ Lightweight with zero dependencies
šŸ’» Written in TypeScript
āš”ļø Easy to integrate
šŸ”’ Common password detection

Installation

npm install @xho/react-password-meter

or

yarn add @xho/react-password-meter

Usage

Basic Usage

import { PasswordStrengthMeter } from "@xho/react-password-meter";

function App() {
  return <PasswordStrengthMeter password="yourpassword" theme="classicTheme" />;
}

With Custom Theme

import { PasswordStrengthMeter, ThemeConfig } from "@xho/react-password-meter";

const customTheme: ThemeConfig = {
  weak: { color: "#ff4d4d", label: "Too Weak" },
  fair: { color: "#ffaa00", label: "Getting Better" },
  good: { color: "#2196f3", label: "Almost There" },
  strong: { color: "#4caf50", label: "Perfect!" },
};

function App() {
  return (
    <PasswordStrengthMeter
      password="yourpassword"
      theme={customTheme}
      onChange={({ score, level }) => console.log(score, level)}
    />
  );
}

Props

PropTypeDefaultDescription
passwordstring""The password to evaluate
themeThemeName \| ThemeConfig"classicTheme"Theme configuration
showLabelbooleantrueWhether to show strength label
classNamestring""Additional CSS classes
onChange(result: StrengthResult) => void-Callback when strength changes
strengthCalculator(password: string) => numberBuilt-in calculatorCustom strength calculation function