BuzzForm
BuzzFormDocs

Password Field

Password input with visibility toggle, strength indicator, and generation.

Password Field

The password field provides a secure password input with optional strength indicator, requirements checklist, and password generation.

Installation

pnpm dlx shadcn@latest add https://form.buildnbuzz.com/r/password.json

Usage

import { createSchema } from "@buildnbuzz/buzzform";
import { Form } from "@/components/buzzform/form";

const schema = createSchema([
  {
    type: "password",
    name: "password",
    label: "Password",
    required: true,
    minLength: 8,
  },
]);

export function PasswordFieldDemo() {
  return <Form schema={schema} onSubmit={console.log} />;
}

Properties

PropTypeDefaultDescription
minLengthnumber8Minimum password length
maxLengthnumber-Maximum password length
criteria.requireUppercasebooleanfalseRequire uppercase letter
criteria.requireLowercasebooleanfalseRequire lowercase letter
criteria.requireNumberbooleanfalseRequire number
criteria.requireSpecialbooleanfalseRequire special character

UI Options

OptionTypeDefaultDescription
ui.strengthIndicatorbooleanfalseShow strength bar
ui.showRequirementsbooleanfalseShow requirements checklist
ui.allowGeneratebooleanfalseShow generate button
ui.copyablebooleanfalseShow copy button

Features

Visibility Toggle

All password fields include a visibility toggle button to show/hide the password.

Strength Indicator

Shows a visual strength bar based on password criteria:

{
  type: "password",
  name: "password",
  label: "Password",
  minLength: 8,
  ui: { strengthIndicator: true },
}

Requirements Checklist

Display a checklist of password requirements:

{
  type: "password",
  name: "password",
  label: "Password",
  minLength: 8,
  criteria: {
    requireUppercase: true,
    requireLowercase: true,
    requireNumber: true,
    requireSpecial: true,
  },
  ui: { showRequirements: true },
}

Password Generation

Allow users to generate a secure password:

{
  type: "password",
  name: "password",
  label: "Password",
  minLength: 12,
  ui: {
    allowGenerate: true,
    copyable: true,
  },
}

Examples

Complete Password Field

{
  type: "password",
  name: "password",
  label: "Password",
  required: true,
  minLength: 8,
  criteria: {
    requireUppercase: true,
    requireNumber: true,
    requireSpecial: true,
  },
  ui: {
    strengthIndicator: true,
    showRequirements: true,
    allowGenerate: true,
    copyable: true,
  },
}

Confirm Password

const schema = createSchema([
  {
    type: "password",
    name: "password",
    label: "Password",
    required: true,
    minLength: 8,
  },
  {
    type: "password",
    name: "confirmPassword",
    label: "Confirm Password",
    required: true,
    validate: (value, { data }) => {
      if (value !== data.password) {
        return "Passwords do not match";
      }
      return true;
    },
  },
]);

On this page