ViraStack
  • Academy
  • About
  • Support
HomeGet StartedExamples
ViraStack

A frontend ecosystem: free guides, project templates, AI rules, and form components.

Products

  • ViraStack Start
  • ViraStack AI
  • ViraStack Mask
  • ViraStack Password
  • ViraStack Guide

Explore

  • Academy
  • About
  • Brand
  • Support

© 2026 ViraStack.

Open source · MIT

Examples

  • All
  • Basic
  • Confirm password
  • Custom icons
  • Custom text
  • Disabled / readOnly
  • Leaked passwords
  • Personal info
  • Programmatic
  • Prop merge
  • React Hook Form + Zod
  • Server Action
  • Show / hide
  • Sign-up with Mask
  • Strength meter

Personal info

Reject passwords that contain the user's email or name.

← All examples·forbidden

Preview

Try vira-garden-path

// components/new-password-field.tsx
"use client";
 
import { useState } from "react";
 
import { useViraPassword } from "@virastack/password";
 
import { passwordMessages } from "@/lib/password-messages";
import { policy } from "@/lib/password-policy";
 
export function NewPasswordField() {
  const [email, setEmail] = useState("hello@virastack.com");
  const [name, setName] = useState("Vira Stack");
 
  // Email: the local part and its pieces ("hello"). Name: each word ("vira", "stack").
  const { inputProps, btnProps, issues, strengthProps } = useViraPassword({
    policy,
    forbidden: [email, name],
  });
 
  return (
    <>
      <label htmlFor="forbidden-email">Email</label>
      <input
        id="forbidden-email"
        value={email}
        onChange={(event) => setEmail(event.target.value)}
      />
 
      <label htmlFor="forbidden-name">Name</label>
      <input id="forbidden-name" value={name} onChange={(event) => setName(event.target.value)} />
 
      <label htmlFor={inputProps.id}>New password</label>
      <div>
        <input {...inputProps} />
        <button {...btnProps} />
      </div>
 
      <p {...strengthProps}>
        {issues.includes("password.containsPersonalInfo")
          ? passwordMessages["password.containsPersonalInfo"]
          : "Try vira-garden-path"}
      </p>
    </>
  );
}

Details

  • Emails are split into the local part and its pieces; the domain is ignored.
  • Pieces shorter than minTokenLength (default 3) are ignored.
  • Case, accents and simple leetspeak are ignored.

For the hook API see useViraPassword(), for styling and icons see customization.

PreviousLeaked passwordsNextProgrammatic

On this page

  • Preview
  • Details
Something wrong? Fix it