# Input OTP: Status

> `status` shows the result of checking the code. `loading` locks the slots and marks the field busy, `error` marks every slot invalid and `success` turns the edges green. Each one is announced. With `animated`, loading runs a wave, error shakes once and success pops the characters.

Example: https://hextaui.com/docs/input-otp/examples/status
Component docs: https://hextaui.com/docs/input-otp.md

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/input-otp-status.json
```

This adds `components/examples/input-otp/status.tsx` with the Input OTP component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/input-otp/status.tsx"
"use client"

import * as React from "react"

import {
  InputOTP,
  InputOTPGroup,
  InputOTPSlot,
  type InputOTPStatus,
} from "@/components/ui/input-otp"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"

const statuses: InputOTPStatus[] = ["idle", "loading", "success", "error"]

export function InputOTPStatusExample() {
  const [status, setStatus] = React.useState<InputOTPStatus>("loading")

  return (
    <div className="flex max-w-full min-w-0 flex-col items-center gap-4">
      <InputOTP
        length={6}
        variant="separate"
        animated
        status={status}
        defaultValue="381904"
        aria-label="Verification code"
      >
        <InputOTPGroup>
          <InputOTPSlot />
          <InputOTPSlot />
          <InputOTPSlot />
          <InputOTPSlot />
          <InputOTPSlot />
          <InputOTPSlot />
        </InputOTPGroup>
      </InputOTP>
      <ToggleGroup
        aria-label="Status"
        size="sm"
        value={[status]}
        onValueChange={(next) => {
          if (next[0]) {
            setStatus(next[0] as InputOTPStatus)
          }
        }}
      >
        {statuses.map((item) => (
          <ToggleGroupItem key={item} value={item}>
            {item}
          </ToggleGroupItem>
        ))}
      </ToggleGroup>
    </div>
  )
}
```

## Props in this example

### InputOTP

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `length` | `number` | – | Required. The number of slots; render the same number of InputOTPSlot parts. |
| `variant` | `"joined" \| "separate"` | `"joined"` |  |
| `animated` | `boolean` | `false` | Animate characters in and out, cascade multi-character input and animate the status. |
| `status` | `"idle" \| "loading" \| "success" \| "error"` | – | The result of checking the code. Loading makes the slots read-only. |
| `defaultValue` | `string` | – |  |

## More Input OTP examples

- [Joined](https://hextaui.com/docs/input-otp/examples/basic.md)
- [Separate](https://hextaui.com/docs/input-otp/examples/separate.md)
- [Sizes](https://hextaui.com/docs/input-otp/examples/sizes.md)
- [Animated](https://hextaui.com/docs/input-otp/examples/animated.md)
- [Controlled](https://hextaui.com/docs/input-otp/examples/controlled.md)
- [Form](https://hextaui.com/docs/input-otp/examples/form.md)
- [With Field](https://hextaui.com/docs/input-otp/examples/field.md)
- [Invalid](https://hextaui.com/docs/input-otp/examples/invalid.md)
- [Letters and numbers](https://hextaui.com/docs/input-otp/examples/alphanumeric.md)
- [Masked](https://hextaui.com/docs/input-otp/examples/masked.md)
- [Custom separator](https://hextaui.com/docs/input-otp/examples/custom-separator.md)
- [Disabled](https://hextaui.com/docs/input-otp/examples/disabled.md)
- [Right to left](https://hextaui.com/docs/input-otp/examples/rtl.md)
