Input OTP 7

PreviousNext

A 4-digit OTP input field with minimal underline styling and no background

Docs
shadcn-studiocomponent

Preview

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

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

export default InputOTPMinimalDemo

Installation

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

Usage

import { InputOtp07 } from "@/components/input-otp-07"
<InputOtp07 />