# Input Otp

> One-time password slots with optional separators.

Registry name: `input-otp`. HTML docs: https://ui.anuragroy.dev/component/input-otp.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/input-otp.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/input-otp.json`.

Registry JSON: https://ui.anuragroy.dev/r/input-otp.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/input-otp.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

```tsx
import {
  InputOTP,
  InputOTPGroup,
  InputOTPSeparator,
  InputOTPSlot
} from "@/components/ui/input-otp"
```

## Usage

```tsx
import {
  InputOTP,
  InputOTPGroup,
  InputOTPSeparator,
  InputOTPSlot,
} from "@/components/ui/input-otp"

export function Example() {
  return (
    <InputOTP length={6}>
      <InputOTPGroup>
        <InputOTPSlot />
        <InputOTPSlot />
        <InputOTPSlot />
      </InputOTPGroup>
      <InputOTPSeparator />
      <InputOTPGroup>
        <InputOTPSlot />
        <InputOTPSlot />
        <InputOTPSlot />
      </InputOTPGroup>
    </InputOTP>
  )
}
```

## API

### InputOTP

Base UI OTP field. Render exactly `length` slots.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `length` | number | — |  |

## See also

- [HTML page](https://ui.anuragroy.dev/component/input-otp): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/input-otp.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
