Password API

API documentation for Password component

Password#

Props#

Defines valid properties in Password component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: PasswordInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: PasswordInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<PasswordPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: PasswordInstance) => ReactNode)
null
The children to render.
onValueChange(event: PasswordChangeEvent) => void
null
Callback fired when the password value changes.
valuestring
null
The controlled value of the password input.
defaultValuestring
null
The default value for uncontrolled mode.
strengthOptionsPasswordStrengthLevel[]
null
Custom strength levels for password calculation.
appendToHTMLElement | "body" | "self"
body
DOM element instance where the overlay panel should be mounted. Valid values are any DOM Element and 'self'. The 'self' value is used to render a component where it is located.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in Password component.

nametypedefaultdescription
valuestring
null
Current password value.
strengthPasswordStrengthResult
null
Current password strength result.
overlayVisibleboolean
null
Whether the overlay is visible.
levelsCountnumber
null
Number of strength levels.
showClearIconboolean
null
Whether the clear icon should be shown.
unmaskedboolean
null
Whether the password is unmasked (visible).
focusedboolean
null
Whether the input is focused.
inputType"text" | "password"
null
The current input type (password or text).

Exposes#

Defines the methods and properties exposed by Password component.

nametypedefaultdescription
stateusePasswordState
null
The state of the usePassword.
inputRefRefObject<{ elementRef: RefObject<HTMLInputElement> }>
null
Input ref for accessing the input element.
overlayRefRefObject<HTMLDivElement>
null
Overlay ref for accessing the overlay element.
portalRefRefObject<{ containerRef: { current: { elementRef: RefObject<HTMLDivElement> } } }>
null
Portal ref for accessing the portal container element.
testRequirement(test: (value: string, strength: PasswordStrengthResult) => boolean) => boolean
null
Test a requirement against the current password.
calculatePasswordStrength(password: string, levels: PasswordStrengthLevel[]) => PasswordStrengthResult
null
Calculate password strength for a given password and levels.
onInputClick() => void
null
Handle input click event.
onInputChange(event: ChangeEvent<HTMLInputElement>) => void
null
Handle input change.
onFocus() => void
null
Handle input focus event.
onBlur() => void
null
Handle input blur event.
onOverlayEnter() => void
null
Callback when overlay enters (for positioning).
changeVisibleState(isVisible: boolean) => void
null
Change the visibility state of the overlay.
onClearClick(event: MouseEvent<HTMLButtonElement>) => void
null
Handle clear button click.
onMaskToggle() => void
null
Toggle password mask visibility.

Events#

Event fired when the password's value state changes.

nametypedescription
valuestringThe new password value.
originalEventChangeEventThe original DOM event.

Interfaces#

Defines passthrough(pt) options of Password component.

nametypedefaultdescription
rootPasswordPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
pcInputTextPasswordPassThroughType<InputHTMLAttributes<HTMLInputElement>>
null
Used to pass attributes to the input's DOM element.
portalPasswordPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the portal's DOM element.
panelPasswordPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the panel's DOM element.
strengthPasswordPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the strength's DOM element.
meterPasswordPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the meter's DOM element.
clearIconPasswordPassThroughType<SVGAttributes<SVGElement>>
null
Used to pass attributes to the clear icon's DOM element.

Types#

Instance of Password component.

values
ComponentInstance<PasswordProps, PasswordState, PasswordExposes>

PasswordInput#

Props#

Defines valid properties in PasswordInputcomponent.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: PasswordInputInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: PasswordInputInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<PasswordInputPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: PasswordInputInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by PasswordInputcomponent.

nametypedefaultdescription
passwordPasswordInstance
null
Instance of the Password component.

Interfaces#

Defines passthrough(pt) options of PasswordInputcomponent.

nametypedefaultdescription
rootPasswordInputPassThroughType<HTMLAttributes<HTMLInputElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of PasswordInputcomponent.

values
ComponentInstance<PasswordInputProps, PasswordInputState, PasswordInputExposes>

PasswordStrength#

Props#

Defines valid properties in PasswordStrength component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: PasswordStrengthInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: PasswordStrengthInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<PasswordStrengthPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: PasswordStrengthInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by PasswordStrength component.

nametypedefaultdescription
passwordPasswordInstance
null
Instance of the Password component.

Interfaces#

Defines passthrough(pt) options of PasswordStrength component.

nametypedefaultdescription
rootPasswordStrengthPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of PasswordStrength component.

values
ComponentInstance<PasswordStrengthProps, PasswordStrengthState, PasswordStrengthExposes>

PasswordMeter#

Props#

Defines valid properties in PasswordMeter component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: PasswordMeterInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: PasswordMeterInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<PasswordMeterPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: PasswordMeterInstance) => ReactNode)
null
The children to render.
indexnumber
null
The index of the meter.
activeboolean
false
Whether this meter is active/filled.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by PasswordMeter component.

nametypedefaultdescription
passwordPasswordInstance
null
Instance of the Password component.

Interfaces#

Defines passthrough(pt) options of PasswordMeter component.

nametypedefaultdescription
rootPasswordMeterPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of PasswordMeter component.

values
ComponentInstance<PasswordMeterProps, PasswordMeterState, PasswordMeterExposes>

PasswordPortal#

Props#

Defines valid properties in PasswordPortalcomponent.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: PasswordPortalInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: PasswordPortalInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<PasswordPortalPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: PasswordPortalInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by PasswordPortalcomponent.

nametypedefaultdescription
passwordPasswordInstance
null
Instance of the Password component.

Interfaces#

Defines passthrough(pt) options of PasswordPortalcomponent.

nametypedefaultdescription
rootPasswordPortalPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
panelPasswordPortalPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the panel's DOM element.

Types#

Instance of PasswordPortalcomponent.

values
ComponentInstance<PasswordPortalProps, PasswordPortalState, PasswordPortalExposes>

PasswordClearIcon#

Props#

Defines valid properties in PasswordClearIcon component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: PasswordClearIconInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: PasswordClearIconInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<PasswordClearIconPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: PasswordClearIconInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by PasswordClearIcon component.

nametypedefaultdescription
passwordPasswordInstance
null
The Password component instance.

Interfaces#

Defines passthrough(pt) options of PasswordClearIcon component.

nametypedefaultdescription
rootPasswordClearIconPassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of PasswordClearIcon component.

values
ComponentInstance<PasswordClearIconProps, PasswordClearIconState, PasswordClearIconExposes>

usePassword#

Props#

Props for the usePassword hook.

nametypedefaultdescription
valuestring
null
The controlled value of the password input.
defaultValuestring
null
The default value for uncontrolled mode.
strengthOptionsPasswordStrengthLevel[]
null
Custom strength levels for password calculation.
appendToHTMLElement | "body" | "self"
body
DOM element instance where the overlay panel should be mounted. Valid values are any DOM Element and 'self'. The 'self' value is used to render a component where it is located.
onValueChange(event: usePasswordChangeEvent) => void
null
Callback fired when the password value changes.

State#

Defines valid state in usePassword.

nametypedefaultdescription
valuestring
null
Current password value.
strengthPasswordStrengthResult
null
Current password strength result.
overlayVisibleboolean
null
Whether the overlay is visible.
levelsCountnumber
null
Number of strength levels.
showClearIconboolean
null
Whether the clear icon should be shown.
unmaskedboolean
null
Whether the password is unmasked (visible).
focusedboolean
null
Whether the input is focused.
inputType"text" | "password"
null
The current input type (password or text).

Exposes#

Defines the methods and properties exposed by usePassword.

nametypedefaultdescription
stateusePasswordState
null
The state of the usePassword.
inputRefRefObject<{ elementRef: RefObject<HTMLInputElement> }>
null
Input ref for accessing the input element.
overlayRefRefObject<HTMLDivElement>
null
Overlay ref for accessing the overlay element.
portalRefRefObject<{ containerRef: { current: { elementRef: RefObject<HTMLDivElement> } } }>
null
Portal ref for accessing the portal container element.
testRequirement(test: (value: string, strength: PasswordStrengthResult) => boolean) => boolean
null
Test a requirement against the current password.
calculatePasswordStrength(password: string, levels: PasswordStrengthLevel[]) => PasswordStrengthResult
null
Calculate password strength for a given password and levels.
onInputClick() => void
null
Handle input click event.
onInputChange(event: ChangeEvent<HTMLInputElement>) => void
null
Handle input change.
onFocus() => void
null
Handle input focus event.
onBlur() => void
null
Handle input blur event.
onOverlayEnter() => void
null
Callback when overlay enters (for positioning).
changeVisibleState(isVisible: boolean) => void
null
Change the visibility state of the overlay.
onClearClick(event: MouseEvent<HTMLButtonElement>) => void
null
Handle clear button click.
onMaskToggle() => void
null
Toggle password mask visibility.

Events#

Event object for value change callback.

nametypedescription
valuestringThe new password value.
originalEventEThe original DOM event.

Types#

Instance of usePassword headless.

values
HeadlessInstance<usePasswordProps, usePasswordState, usePasswordExposes>