Input OTP

A one-time-passcode input rendered as a row of single-character slots. Auto-advances on input, supports paste-fill across all slots, and emits onComplete once filled.

-

Anatomy

  • InputOTP — Root.
  • InputOTPGroup — A horizontal cluster of slots.
  • InputOTPSlot — A single character cell with a fake caret indicator.
  • InputOTPSeparator — A small dot between groups.

Installation

Props

PropTypeDefaultDescription
length
number6Number of slots.
value
stringControlled current value.
onChange
(value: string) => voidCalled as the user types.
onComplete
(value: string) => voidCalled when the value reaches length.
mask
booleanfalseDisplay dots instead of digits.
autoFocus
booleanfalseFocus the first slot on mount.