Input OTP 5

PreviousNext

A 4-digit OTP input field with outlined styling and rounded borders

Docs
shadcn-studiocomponent

Preview

Loading preview…
registry/new-york/components/input-otp/input-otp-05.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 InputOTPOutlinedDemo = () => {
  const id = useId()

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

export default InputOTPOutlinedDemo

Installation

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

Usage

import { InputOtp05 } from "@/components/input-otp-05"
<InputOtp05 />