Input OTP 6

PreviousNext

A 4-digit OTP input field with filled background styling and muted appearance

Docs
shadcn-studiocomponent

Preview

Loading preview…
registry/new-york/components/input-otp/input-otp-06.tsx
import { useId } from 'react'

import { InputOTP, InputOTPGroup, InputOTPSlot } from '@/registry/new-york/ui/input-otp'
import { Label } from '@/registry/new-york/ui/label'

const InputOTPFilledDemo = () => {
  const id = useId()

  return (
    <div className='space-y-3'>
      <Label htmlFor={id}>Input OTP filled</Label>
      <InputOTP id={id} maxLength={4}>
        <InputOTPGroup className='*:data-[slot=input-otp-slot]:bg-muted gap-2 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border *:data-[slot=input-otp-slot]:border-transparent *:data-[slot=input-otp-slot]:shadow-none'>
          <InputOTPSlot index={0} />
          <InputOTPSlot index={1} />
          <InputOTPSlot index={2} />
          <InputOTPSlot index={3} />
        </InputOTPGroup>
      </InputOTP>
    </div>
  )
}

export default InputOTPFilledDemo

Installation

npx shadcn@latest add @shadcn-studio/input-otp-06

Usage

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