Skip to content

Password Input

A recessed password field pairs a reveal control with an optional strength indicator.

LIVE PREVIEWInteract with the component
Just React. No extra dependencies.

Copy the component and its CSS module into your project.

CSS Modules

Usage

Matches your current playground settings.

jsx
import PasswordInput from "./PasswordInput";
export default function Example() {
return (
<PasswordInput
defaultValue={"studio-example"}
label={"Password"}
placeholder={"Enter your password"}
showLabel={"Show password"}
hideLabel={"Hide password"}
strength={3}
strengthLabel={"Example strength indicator"}
color={"#baafce"}
disabled={false}
required={false}
autoComplete={"new-password"}
/>
);
}

Using Password Input

Connect value and onValueChange to your form state, or use defaultValue for local state. Set name for form submission and choose the appropriate autocomplete hint.

The component only displays the supplied strength and strengthLabel. Calculate any strength assessment in your application; the reveal button changes visibility without changing the stored value.

Props

NameTypeRequiredDefaultDescription
valuestringNoundefinedControlled password value.
defaultValuestringNo""Initial uncontrolled value.
onValueChangefunctionNoundefinedReceives the entered value.
labelstringNo"Password"Visible input label.
placeholderstringNo""Input placeholder.
showLabelstringNo"Show password"Hidden-state reveal button label.
hideLabelstringNo"Hide password"Visible-state reveal button label.
strengthnumberNoundefinedOptional caller-calculated strength display from zero to four.
strengthLabelstringNoundefinedOptional explanation associated with the input.
colorstringNo"#baafce"Accent and strength colour.
disabledbooleanNofalseDisable input and reveal control.
requiredbooleanNofalseMark the native input as required.
namestringNoundefinedNative form field name.
autoCompletestringNo"current-password"Native autocomplete hint.
classNamestringNo""Additional classes on the root element.
styleCSSPropertiesNoundefinedInline styles for sizing, typography and appearance.

Related components

Editable tags collect inside a softly framed input with individual remove controls.

A recessed search field expands into a polished capsule as you type.

Faceted stars lift into selection with a small marker beneath the chosen rating.

A bank of tactile keys holds independent selections with illuminated indicators.