PasswordInput

PasswordInput is a component that allows users to input passwords with a visibility toggle.

Usage

import { PasswordInput, StrengthMeter } from "@yamada-ui/react"
<PasswordInput />
<StrengthMeter />

Change Variants

Change Size

Change Color Scheme

Default Visible

To display the value by default, set defaultVisible to true.

Show Strength Meter

To display the strength meter, use StrengthMeter.

Medium

Change Border Color

To change the border color, set focusBorderColor or errorBorderColor to the color.

Change Placeholder Color

To change the placeholder color, set _placeholder to the color.

Disable

To disable, set disabled to true.

Read-Only

To make read-only, set readOnly to true.

Invalid

To make invalid, set invalid to true.

Customize Icon

To customize icons, set on and off of visibilityIcon to ReactNode.

Control

Password visibility: show

Props

Accessibility

If you are not using Field.Root, set aria-label or aria-labelledby to PasswordInput.

<PasswordInput aria-label="Your password" />
<VStack gap="sm">
  <Text as="h3" id="label">
    Your password
  </Text>

  <PasswordInput aria-labelledby="label" />
</VStack>

ARIA Roles and Attributes

ComponentRole and AttributeUsage
PasswordInputFieldaria-invalidSet to "true" if invalid is set.
aria-disabledSet to "true" if disabled is set.
aria-describedbyIf PasswordInput is within a Field.Root and Field.Root has an errorMessage, helperMessage, or a Field.ErrorMessage, Field.HelperMessage, sets its id.
aria-readonlySet to "true" if readOnly is set.
aria-requiredSet to "true" if required is set.
PasswordInputButtonaria-labelSets "Toggle password visibility".
StrengthMeterrole="meter"Indicates that this is a meter.
aria-labelSets "Password strength meter".
aria-valueminSets to 0.
aria-valuemaxSet to max value.
aria-valuenowSet to current value.