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 * as InputOTP from "@/registry/radix-ui/ui/input-otp"
 
export function InputOTPExample() {
  const [value, setValue] = useState("")
 
  return (
    <InputOTP.Root
      value={value}
      onChange={setValue}
      maxLength={6}
      render={({ slots }) => (
        <InputOTP.Group>
          {slots.map((slot, index) => (
            <InputOTP.Slot key={index} {...slot} index={index} />
          ))}
        </InputOTP.Group>
      )}
    />
  )
}

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.