PasswordInput

A password field with a show/hide toggle and an optional strength meter.

Status: beta. Category: Forms.

import { PasswordInput } from '@glyphui/ui'

Exports: PasswordInput, passwordStrength, passwordInputStyles.

Notes

  • The toggle is a real button with aria-pressed, so screen readers announce whether the password is visible.
  • The strength meter is a hint for people. Enforce password rules on the server.

PasswordInput props

PropTypeDefaultDescription
defaultVisiblebooleanStart with the password visible.
inputClassNamestringClasses for the <input> element itself. className styles the outer frame.
prefixReactNodeContent before the text, e.g. an icon or https://.
showStrengthbooleanShow a strength meter under the field once the user starts typing.
size"sm" | "md" | "lg"

Example: Sign in

import { Field, PasswordInput } from '@glyphui/ui'

export default function Example() {
  return (
    <Field label="Password" className="w-72">
      <PasswordInput placeholder="Your password" />
    </Field>
  )
}

Example: New password with strength

passwordStrength() is exported too.

import { Field, PasswordInput } from '@glyphui/ui'

export default function Example() {
  return (
    <Field
      label="New password"
      description="At least 12 characters, mixing letters, numbers and symbols."
      className="w-80"
    >
      <PasswordInput autoComplete="new-password" showStrength />
    </Field>
  )
}

Live page: https://glyphui.xyz/components/password-input