# Input OTP: Right to left

> Slots fill from the right and the arrow keys follow what you see. Give slots after the first a translated `aria-label`. Set `dir="ltr"` on the field to keep a code left to right in a right-to-left page.

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

## Add this example

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

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

## Source

```tsx title="components/examples/input-otp/rtl.tsx"
import {
  InputOTP,
  InputOTPGroup,
  InputOTPSeparator,
  InputOTPSlot,
} from "@/components/ui/input-otp"
import { Label } from "@/components/ui/label"

export function InputOTPRtl() {
  return (
    <div
      dir="rtl"
      className="flex max-w-full min-w-0 flex-col items-start gap-2"
    >
      <Label htmlFor="input-otp-rtl">رمز التحقق</Label>
      <InputOTP id="input-otp-rtl" length={6} animated>
        <InputOTPGroup>
          <InputOTPSlot />
          <InputOTPSlot aria-label="الخانة ٢ من ٦" />
          <InputOTPSlot aria-label="الخانة ٣ من ٦" />
        </InputOTPGroup>
        <InputOTPSeparator />
        <InputOTPGroup>
          <InputOTPSlot aria-label="الخانة ٤ من ٦" />
          <InputOTPSlot aria-label="الخانة ٥ من ٦" />
          <InputOTPSlot aria-label="الخانة ٦ من ٦" />
        </InputOTPGroup>
      </InputOTP>
    </div>
  )
}
```

## Props in this example

### InputOTP

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `length` | `number` | – | Required. The number of slots; render the same number of InputOTPSlot parts. |
| `animated` | `boolean` | `false` | Animate characters in and out, cascade multi-character input and animate the status. |
| `id` | `string` | – | Goes on the first slot, so a label's htmlFor points at it. |

### InputOTPSlot

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `aria-label` | `string` | `"Character N of M"` | Ignored on the first slot, which uses the label. |

## 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)
- [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)
