Skip to Content
ComponentsPassword

Password

Password input compound component with a built-in show/hide toggle. data-visible on the Toggle reflects visibility. Validation is consumer-controlled.

Preview

Anatomy

import { Password } from '@wire-ui/react' <Password.Root> <Password.Label>Password</Password.Label> <Password.Field placeholder="••••••••" /> <Password.Toggle /> <Password.Error /> </Password.Root>

Root props

PropTypeDefaultDescription
valuestringControlled value
defaultValuestring''Initial value for uncontrolled use
onChange(value: string) => voidCalled on every keystroke
onFocus() => voidCalled on focus
onBlur() => voidCalled on blur
invalidTypestring''Key into errorMessage; consumer-controlled
errorMessageRecord<string, string>{}Map of error keys to display strings
isRequiredbooleanfalseShows * in label
idstringauto-generatedLinks label to field

Toggle data attributes

AttributeWhen present
data-visiblePassword is currently visible (type=“text”)

Use data-visible to conditionally show a show/hide icon:

<Password.Toggle aria-label="Toggle password visibility"> {/* Eye icon — visible when password is hidden */} <EyeIcon className="[data-visible_&]:hidden" /> {/* Eye-off icon — visible when password is shown */} <EyeOffIcon className="hidden [data-visible_&]:inline" /> </Password.Toggle>

Toggle accessibility

The Toggle renders as a <button> with:

  • aria-label="Show password" when password is hidden
  • aria-label="Hide password" when password is visible

No additional ARIA needed.

Last updated on

MIT License © 2026 wire-ui