Skip to content

PasswordInputProps

"aria-describedby"?: string;

ids of external error/help text. Merged with the ids this component owns.


"aria-label"?: string;

Accessible name, when there is no visible text to point label at. Wins over label if both are given.


autoComplete?: string;

Password managers key off this.

‘current-password’ Set 'new-password' on sign-up and change-password forms.


autoFocus?: boolean;

Focus the field on mount.

false

blocklist?: string[];

Extra low-entropy strings to reject, e.g. your product name.


capsLockLabel?: ReactNode;

Text of the Caps Lock warning.

'Caps Lock is on'

capsLockWarning?: boolean;

Warn while Caps Lock is on.

true

checkCompromised?: (password, signal) => Promise<boolean>;

Optional async check against a breach corpus. Called debounced, with an AbortSignal that fires when the password changes again or the component unmounts. The library never makes a network request itself — wire this to a k-anonymity endpoint (or your own service) and keep the plaintext local.

ParameterType
passwordstring
signalAbortSignal

Promise<boolean>


checkCompromisedDelay?: number;

Debounce before checkCompromised runs, in ms.

400

className?: string;

compromisedLabel?: ReactNode;

Message shown when checkCompromised resolves true.

a stock sentence

defaultRevealed?: boolean;

Initial reveal state for the uncontrolled case.

false

defaultValue?: string;

Uncontrolled initial password. Ignored when value is provided.


disabled?: boolean;

estimate?: (password) => PasswordStrength;

Swap the built-in estimator — pass a zxcvbn adapter here if you want its wordlists and are willing to pay ~350 kB (minified + brotli) for them.

ParameterType
passwordstring

PasswordStrength

the built-in estimateStrength


hideOnBlur?: boolean;

Re-mask when focus leaves the field, so a revealed password does not sit on screen after the user tabs away.

true

hideRevealToggle?: boolean;

Drop the reveal button entirely.

false

id?: string;

Base id; the input, meter, checklist and warnings derive ids from it.


invalid?: boolean;

Sets aria-invalid and data-invalid on the field.


label?: ReactNode;

Accessible name for the field. Not rendered — supply your own visible <label htmlFor={${id}-input}> when the design calls for one, exactly as every other input in the suite expects. A node is exposed through a hidden element, since aria-label only takes a string.


maxLength?: number;

Native maxlength. There is always a cap — an unbounded field lets a single paste drive unbounded estimator and KDF work — and this prop only moves it. NIST SP 800-63B requires accepting at least 64 characters, so the default sits at double that; a value below minLength is unsatisfiable and falls back to the default rather than removing the cap.

128

minLength?: number;

Minimum length for the default rule and the native minlength.

8

minScore?:
| PasswordScore
| null;

Minimum score to count as valid. null disables the gate.

null

name?: string;

onBlur?: (event) => void;
ParameterType
eventFocusEvent<HTMLElement>

void


onChange?: (value) => void;
ParameterType
valuestring

void


onFocus?: (event) => void;
ParameterType
eventFocusEvent<HTMLElement>

void


onRevealChange?: (revealed) => void;
ParameterType
revealedboolean

void


onValidityChange?: (valid) => void;

Fires whenever overall validity changes — all required rules met and minScore reached.

ParameterType
validboolean

void


onWarn?: (warning) => void;

Called in development whenever a prop is coerced or a configuration looks wrong — see PasswordWarning. The coerced result still renders, so this never changes what the user sees. When omitted, the same warnings go to console.warn. The entire path is stripped from production builds.

ParameterType
warningPasswordWarning

void


placeholder?: string;

readOnly?: boolean;

required?: boolean;

revealed?: boolean;

Controlled reveal state. Omit to let the component own it.


revealIcon?: ReactNode | ((state) => ReactNode);

Custom reveal-button contents.

a built-in eye glyph

revealLabel?: string | ((state) => string);

Accessible name for the reveal button.

'Show password' / 'Hide password'

rules?: PasswordRule[];

NIST SP 800-63B leads with length and explicitly advises against composition rules, so the default is a single length rule. Pass your own array to opt into more.


showRules?: boolean;

Render the requirement checklist.

rules was provided


showStrength?: boolean;

Render the strength meter.

false

strengthLabel?: (strength) => ReactNode;

Label under the meter for a score.

ParameterType
strengthPasswordStrength

ReactNode

'Very weak' … 'Strong'

style?: CSSProperties;

userInputs?: string[];

Values the user has already typed elsewhere — email, username, name. A password containing any of them is penalised. Nothing leaves the browser.


value?: string;

Controlled password.