# Password input

A password field with a key to show or hide it.

[View Password input on CyberSpec](https://www.cyberspec.dev/components/sidebar/password-input)

## Component

Password input belongs to the Fields group in the CyberSpec catalog. It uses @ui-sdk/react/password-input, @ui-sdk/react/field.

## Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/password-input.json
```

## Example

```tsx
"use client"

import { PasswordInput } from "@/components/ui/password-input"

export default function PasswordInputDemo() {
  return (
    <>
      <PasswordInput label="Passphrase" defaultValue="lowtide-0417-ghost" hint="Unlocks the deck. Never leaves it." autoComplete="off" required />
      <PasswordInput
        label="Relay key"
        defaultValue="7Hq2-vX9p"
        defaultVisible
        error="Key rejected by the Glasswater relay."
        autoComplete="off"
      />
      <PasswordInput label="Vault phrase" defaultValue="sealed" autoComplete="off" disabled />
    </>
  )
}
```

## Install this example

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/password-input-demo.json
```

## Resources

- [Interactive Password input preview](https://www.cyberspec.dev/preview/password-input)
- [Component catalog](https://www.cyberspec.dev/components.md)
- [Password input source code](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/ui/password-input.tsx)
- [Shadcn registry item](https://www.cyberspec.dev/r/password-input.json)
