BuzzForm
BuzzFormDocs

Password Field

Password input with strength criteria validation.

Password Field

The password field renders a password input with optional strength criteria.

Schema Properties

Prop

Type

UI Options

OptionTypeDefaultDescription
strengthIndicatorbooleanfalseShow a strength indicator bar
showRequirementsbooleanfalseShow a checklist of requirements
allowGeneratebooleanfalseShow a generate password button
copyablebooleanfalseShow a copy button
labelsobject-Text and label overrides
labels.strengthobject-Custom labels for strength levels
labels.requirementsobject-Custom labels for checklist items
classNamestring-CSS class applied to the container
widthstring | number-Inline width applied to the field

React Overrides: The label, description, and all ui.labels properties support ReactNode (JSX) when importing defineSchema from @buildnbuzz/form-react.

Basic Usage

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

Password Criteria

Set strength requirements:

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

Examples

Confirm Password

const schema = defineSchema({
  fields: [
    {
      type: "password",
      name: "password",
      label: "Password",
      required: true,
      minLength: 8,
    },
    {
      type: "password",
      name: "confirmPassword",
      label: "Confirm Password",
      required: true,
      validate: {
        onSubmit: {
          checks: [
            {
              type: "matches",
              message: "Passwords do not match",
              args: { other: { $data: "/password" } },
            },
          ],
        },
      },
    },
  ],
});

Auto-Derived Validators

PropertyValidator
required: truerequired
minLengthminLength
maxLengthmaxLength
criteriapasswordCriteria

On this page