OTP Input with Custom Separator

PreviousNext

An OTP input with custom separator between fields

Docs
shadcnui-blockscomponent

Preview

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

export default function InputOTPDemo() {
  return (
    <InputOTP maxLength={6}>
      <InputOTPGroup>
        <InputOTPSlot index={0} />
        <InputOTPSlot index={1} />
        <InputOTPSlot index={2} />
      </InputOTPGroup>
      <div role="separator" className="text-muted-foreground">
        <Dot />
      </div>
      <InputOTPGroup>
        <InputOTPSlot index={3} />
        <InputOTPSlot index={4} />
        <InputOTPSlot index={5} />
      </InputOTPGroup>
    </InputOTP>
  );
}

Installation

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

Usage

import { InputOtp06 } from "@/components/input-otp-06"
<InputOtp06 />