Skip to content

Instantly share code, notes, and snippets.

const { useState } = React;
const PasswordStrength = () => {
const [password, setPassword] = useState('');
const requirements = [
{ label: '8+ characters', check: (pwd) => pwd.length >= 8 },
{ label: '12+ characters', check: (pwd) => pwd.length >= 12 },
{ label: 'Lowercase letter', check: (pwd) => /[a-z]/.test(pwd) },
{ label: 'Uppercase letter', check: (pwd) => /[A-Z]/.test(pwd) },