Back

PasswordInput

Basic Usage

States

Password is too weak.

With Strength Meter

Enable ShowStrength for a zxcvbn-powered strength bar that scores passwords from 0 (Very Weak) to 4 (Strong).

  • 8+ characters

With Requirements

Combine strength scoring with requirement checks for a complete password policy.

  • 8+ characters
  • Uppercase letter
  • Lowercase letter
  • Number
  • Special character

Custom Min Length

Set MinLength to require longer passwords.

  • 12+ characters
  • Uppercase letter
  • Number

Usage

A password field with a built-in visibility toggle powered by Alpine.js. Enable ShowStrength to add a zxcvbn-powered strength meter with configurable requirements.

@forms.PasswordInput(forms.PasswordInputProps{
    Label:            "Password",
    Name:             "password",
    Placeholder:      "Enter your password",
    Required:         true,
    ShowStrength:     true,
    MinLength:        8,       // default 8
    RequireUppercase: true,
    RequireLowercase: true,
    RequireNumber:    true,
    RequireSpecial:   true,
})