HextaUI

Input OTP: Separate

variant="separate" gives every slot its own rounded box with a gap between them.

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

export function InputOTPSeparate() {
  return (
    <InputOTP length={6} variant="separate" aria-label="Verification code">
      <InputOTPGroup>
        <InputOTPSlot />
        <InputOTPSlot />
        <InputOTPSlot />
        <InputOTPSlot />
        <InputOTPSlot />
        <InputOTPSlot />
      </InputOTPGroup>
    </InputOTP>
  )
}

This adds the example as components/examples/input-otp/separate.tsx, together with the Input OTP component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/input-otp-separate.json

To add only the component, follow the Input OTP installation.

Props in this example

The Input OTP props this example sets, from the API reference.

PropTypeDefault
lengthRequired. The number of slots; render the same number of InputOTPSlot parts.
number–
variant
"joined" | "separate""joined"

Every prop is in the Input OTP API reference.

See them all, with keyboard support and accessibility notes, on the Input OTP page.