Beta

Search Documentation

Search through documentation pages

Components

Input OTP

A one-time password input with individual character slots, built on input-otp.

Preview

'use client';

import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from '@/registry/san-francisco/ui/input-otp';

export default function InputOtpDemo() {
  return (
    <InputOTP maxLength={6}>
      <InputOTPGroup>
        <InputOTPSlot index={0} />
        <InputOTPSlot index={1} />
        <InputOTPSlot index={2} />
      </InputOTPGroup>
      <InputOTPSeparator />
      <InputOTPGroup>
        <InputOTPSlot index={3} />
        <InputOTPSlot index={4} />
        <InputOTPSlot index={5} />
      </InputOTPGroup>
    </InputOTP>
  );
}

Installation

bun
bunx shadcn@latest add @sft-ui/input-otp

Without Separator

'use client';

import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from '@/registry/san-francisco/ui/input-otp';

export default function InputOtpDemoWithoutSeparator() {
  return (
    <InputOTP maxLength={4}>
      <InputOTPGroup>
        <InputOTPSlot index={0} />
        <InputOTPSlot index={1} />
        <InputOTPSlot index={2} />
        <InputOTPSlot index={3} />
      </InputOTPGroup>
    </InputOTP>
  );
}

API Reference

See the input-otp documentation for the API reference.