# Input OTP: Animated

> `animated` is off by default. With it, typed characters rise in, deleted ones sink out while the rest slide over, and a whole code from autofill, paste or your own state cascades in slot by slot. Press Fill code to see the cascade.

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

## Add this example

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

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

## Source

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

import * as React from "react"

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

export function InputOTPAnimated() {
  const [value, setValue] = React.useState("")

  return (
    <div className="flex max-w-full min-w-0 flex-col items-center gap-4">
      <InputOTP
        length={6}
        variant="separate"
        animated
        value={value}
        onValueChange={setValue}
        aria-label="Verification code"
      >
        <InputOTPGroup>
          <InputOTPSlot />
          <InputOTPSlot />
          <InputOTPSlot />
        </InputOTPGroup>
        <InputOTPSeparator />
        <InputOTPGroup>
          <InputOTPSlot />
          <InputOTPSlot />
          <InputOTPSlot />
        </InputOTPGroup>
      </InputOTP>
      <div className="flex gap-2">
        <Button variant="outline" size="sm" onClick={() => setValue("482913")}>
          Fill code
        </Button>
        <Button variant="ghost" size="sm" onClick={() => setValue("")}>
          Clear
        </Button>
      </div>
    </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. |
| `value` | `string` | – |  |
| `onValueChange` | `(value: string, details) => void` | – |  |

## 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)
- [Status](https://hextaui.com/docs/input-otp/examples/status.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)
