Separated OTP Input (Alternate)

PreviousNext

An alternate style of separated OTP input fields

Docs
shadcnui-blockscomponent

Preview

Loading preview…
components/customized/input-otp/input-otp-04.tsx
import {
  InputOTP,
  InputOTPGroup,
  InputOTPSeparator,
  InputOTPSlot,
} from "@/registry/ui/input-otp";

export default function InputOTPDemo() {
  return (
    <InputOTP maxLength={6}>
      <InputOTPGroup className="space-x-1">
        <InputOTPSlot index={0} className="rounded-md border-l" />
        <InputOTPSlot index={1} className="rounded-md border-l" />
        <InputOTPSlot index={2} className="rounded-md border-l" />
      </InputOTPGroup>
      <InputOTPSeparator />
      <InputOTPGroup className="space-x-1">
        <InputOTPSlot index={3} className="rounded-md border-l" />
        <InputOTPSlot index={4} className="rounded-md border-l" />
        <InputOTPSlot index={5} className="rounded-md border-l" />
      </InputOTPGroup>
    </InputOTP>
  );
}

Installation

npx shadcn@latest add @shadcnui-blocks/input-otp-04

Usage

import { InputOtp04 } from "@/components/input-otp-04"
<InputOtp04 />