# Password

> Cherry Password component - a password input with a built-in show/hide reveal toggle.

Source: https://cherry.al/code/password

> For the complete documentation index, see [llms.txt](https://cherry.al/llms.txt).

# Password

<iframe className="light-only" src="https://demo.cherry.al/preview/password?theme=light" title="Password" loading="lazy" style={{ width: "100%", height: "320px", border: "1px solid var(--color-grayLight)", borderRadius: "12px" }} />
<iframe className="dark-only" src="https://demo.cherry.al/preview/password?theme=dark" title="Password" loading="lazy" style={{ width: "100%", height: "320px", border: "1px solid var(--color-grayLight)", borderRadius: "12px" }} />

The Password component wraps the Cherry Input with `type="password"` and adds a show/hide reveal toggle pinned inside the field.

It accepts every Input property except `type`, `$icon`, and `$iconPosition`: `type` is owned by the component to flip between masked and plain text, and the icon slot is reserved for the reveal button. Small fields automatically get a matching small reveal button.

Keep in mind that the `<input>` element inherently includes native browser properties like `onChange`. Cherry UI components introduce custom properties that always begin with a `$` to distinguish them from native props.

For design guidelines and all interactive states, see the [Inputs](/inputs) design page.

```jsx
import React from "react";
import { Password } from "cherry-styled-components";

export default function Page() {
  return <Password $label="Password" $fullWidth id="password" />;
}
```

With sizes and validation states:

```html
<Password $size="big" $fullWidth />
<Password $error $fullWidth />
```

## Properties

<Field value="$label" type="string">
  Label text displayed above the input.
</Field>

<Field value="$size" type='"default" | "big" | "small"'>
  Size of the input. The `small` size also shrinks the reveal button.
</Field>

<Field value="$error" type="boolean">
  Shows error state styling on the field and the reveal button.
</Field>

<Field value="$success" type="boolean">
  Shows success state styling.
</Field>

<Field value="$fullWidth" type="boolean">
  Makes the input span the full width of its container.
</Field>

<Field value="$wrapperClassName" type="string">
  Class name applied to the wrapper element around the input, for restyling from the outside.
</Field>

<Callout type="note">
  The reveal toggle manages `aria-pressed` and swaps its accessible label
  between "Show password" and "Hide password" automatically.
</Callout>

<Button href="https://github.com/cherry-design-system/styled-components/blob/main/src/lib/password.tsx" icon="code" iconPosition="left">
  View Source
</Button>
