Skip to Content

OTP Field

An OTP field allows a user to enter a one-time password or verification code, one character per input slot.

Length

Masked

Disabled

Controlled

Value: (empty)

Component props

NameTypeDescription
lengthnumberNumber of input slots (default: 6)
labelstringLabel text displayed above the field
valuestringControlled value
defaultValuestringDefault value
maskbooleanMasks entered characters (default: false)
autoSubmitbooleanSubmits the owning form when all slots are filled
validationTypestring"numeric" | "alpha" | "alphanumeric" | "none"
isDisabledbooleanDisables the field
isReadOnlybooleanPrevents changing the value
isRequiredbooleanMarks the field as required
onChange(value: string) => voidCalled when the value changes
onComplete(value: string) => voidCalled when all slots are filled