OTP Input

One-time-code boxes with auto-advance, Backspace, arrow keys and paste.

no dependenciesMIT · free

Type or paste a 6-digit code.

Installation

npx shadcn@latest add https://ombakui.com/r/otp-input.json

Usage

import { OtpInput } from "@/components/otp-input";

<OtpInput length={6} onComplete={(code) => verify(code)} />

Props

PropTypeDefaultDescription
lengthnumber6Number of boxes.
onChange(code: string) => void–Called on every change with the current code.
onComplete(code: string) => void–Called once every box is filled.
numericbooleantrueOnly accept digits.
labelstring"Verification code"Accessible name for the group.
classNamestring–