Input OTP

PreviousNext

A one-time password input component for verification codes.

Component input-otp-demo not found in registry.

Installation

pnpm add input-otp

Usage

import {
  InputOTP,
  InputOTPGroup,
  InputOTPSeparator,
  InputOTPSlot,
} from "@/registry/react-aria/ui/input-otp"
 
export function InputOTPExample() {
  const [value, setValue] = useState("")
 
  return (
    <InputOTP value={value} onChange={setValue} 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>
  )
}

Examples

Component input-otp-demo not found in registry.

Component input-otp-4-digit not found in registry.

Component input-otp-multiple-separators not found in registry.

Component input-otp-error not found in registry.

Component input-otp-disabled not found in registry.