1. Docs
  2. Components
  3. Input OTP

Input OTP

Accessible one-time password component with copy paste functionality.

Installation

Anatomy

Examples

Pattern

Use the pattern prop to define a custom pattern for the OTP input.

Separator

You can use the <InputOTPSeparator /> component to add a separator between the input groups.

Controlled

You can use the value and onChange props to control the input value.

Form

Component input-otp-form-demo not found in registry.

API Reference

InputOTP.Root

PropTypeDefault
maxLength
number
value
string
onChange
function
pattern
RegExp
disabled
boolean
autoFocus
boolean
containerClassName
string

InputOTP.Group

PropTypeDefault
children
ReactNode
className
string

InputOTP.Slot

PropTypeDefault
index
number
className
string

InputOTP.Separator

PropTypeDefault
className
string