Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-password-field.json --yes

Password field

Pro

A field for a password with a button that shows or hides the typed words, for sign-in, sign-up and reset forms, for React and Tailwind CSS. Part of Goop Pro.

Type a password and watch the strength and the rules follow each key; show and hide it with the eye (the line under the form says which); turn Caps Lock on to see the warning. Create account is refused until the password reads Fair or better, then the account is made. No account is made and nothing is sent; the check of leaked passwords a server owes is not there.

When to use

  • A field for a password with a button that shows or hides the typed words, for sign-in, sign-up and reset forms.
  • Use PasswordField for every password; never a TextInput with type="password". Put PasswordStrength and PasswordRules under it (as its children) only where a person is choosing a new password, fed by scorePassword(password) (or your own scoring), and never add a field to repeat it: the button lets a person check what they typed.
  • Also called: password input.

Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Password field on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-password-field.json --yes
PROMPT
Add the Goop Password field to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { useState } from 'react';
import { Field } from '@/components/ui/goop/field';
import {
  PasswordField,
  PasswordRules,
  PasswordStrength,
  scorePassword,
} from '@/components/ui/goop/password-field';

function NewPassword() {
  const [password, setPassword] = useState('');
  const { score, rules } = scorePassword(password);
  return (
    <Field label="Password" orientation="vertical" className="w-full">
      <PasswordField
        purpose="new"
        name="password"
        value={password}
        onChange={(event) => setPassword(event.currentTarget.value)}
      >
        <PasswordStrength score={score} />
        <PasswordRules rules={rules} />
      </PasswordField>
    </Field>
  );
}
  • Fits: account (its recipe).
  • Also known as: PasswordInput, Input type="password", ShowPassword, PasswordToggle.
  • height, width, padding, gap, background, text: add no class for these.

API reference

  • Each option with its sentence: password-field--options.md
  • State: visible (visible / defaultVisible / onVisibleChange)
  • Types: PasswordRule = { label: ReactNode; met: boolean }
Parts
PartWhat it is
PasswordStrengthHow strong a new password is (score, 0 to 4, from scorePassword or your own code); its props: password-field--password-strength.md
PasswordRulesThe rules a new password must meet, as a checklist; rules: readonly PasswordRule[] — The rules, in the order they are read; metLabel?: string = 'met' — The hidden word read after a rule that is met; it never shows; unmetLabel?: string = 'not met' — The hidden word read after a rule that is not met yet; it never shows
scorePasswordScores a new password for PasswordStrength and tests it against the rules PasswordRules lists, in one call
  • data-slot values (to select a part by): password-field, password-field-addon, password-field-content, password-field-frame, password-field-status, password-field-status-icon, password-rule, password-rule-icon, password-rules, password-strength, password-strength-description, password-strength-header, password-strength-icon, password-strength-label, password-strength-value

PasswordField: every option

TSX
import { PasswordField } from '@/components/ui/goop/password-field';

Options

  • purpose?: 'current' | 'new' = 'current' — What the password is for: current a sign-in or a confirm step, new a sign-up or a change — it sets autoComplete to current-password or new-password (an autoComplete of your own wins).
  • visible?: boolean — Whether the typed words show, controlled.
  • defaultVisible?: boolean = false — Whether the typed words show at first, uncontrolled (hidden if left out).
  • onVisibleChange?: (visible: boolean) => void — Called with whether the words show, each time the button is pressed and when the form is sent (false).
  • showLabel?: string = 'Show password' — The button's one name, read with its pressed state; a second field on the page names its own ("Show repeated password").
  • capsLockNotice?: ReactNode | false = 'Caps Lock is on' — The words shown while Caps Lock is on and the field has the focus; false shows none.
  • children?: ReactNode — What stands under the field, in its column: a PasswordStrength, then a PasswordRules.
  • Also takes: value?: string; defaultValue?: string; onChange?: (event: ChangeEvent<HTMLInputElement>) => void; name?: string; required?: boolean; disabled?: boolean; form?: string
  • State: visible (visible / defaultVisible / onVisibleChange)

PasswordStrength

How strong a new password is (score, 0 to 4, from scorePassword or your own code).

TSX
import { PasswordStrength } from '@/components/ui/goop/password-field';

Options

  • score: 0 | 1 | 2 | 3 | 4 — The password's strength, 0 (too short) to 4 (strong): scorePassword's score, or your own code's.
  • words?: readonly [string, string, string, string, string] — The word for each score, weakest first (default Too short, Weak, Fair, Good, Strong).
  • label?: ReactNode = 'Strength' — What the bar measures, over its start.
  • overLabel?: string = 'Too weak' — The words read with the bar under Fair (Too short and Weak), where it warns (default "Too weak").
  • aria-label?: string — The bar's name where no label is drawn.

Keyboard

KeyWhat it does
TabMove from the field to its show-password button, then on to the next control
Enter SpaceOn the button: show the typed words, or hide them again

Accessibility

  • The part itself answers the keys above.
  • focus: the browser's own (:focus): write nothing

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
pressedthe attribute aria-pressed
disabledthe prop disabled

Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

goop.so/themes/meadow/components/password-field.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-password-field.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.