Skip to Content
✨ QuickCode UI keeps growing! More components, more features, and more ways to make your projects shine. Stay tuned & maybe… hire me or sponsor me 😉 
DocumentationOTP Input

OTP Input

A fully accessible one-time password input component with keyboard navigation, paste support, and customizable layouts.

Install Dependencies

npx
quickcode-ui add OtpInput

Examples

Basic OTP Input

Enter the 6-digit code sent to your device

4-Digit PIN

Enter your 4-digit PIN

Controlled with State

Current value: (empty)

Alphanumeric Pattern

Enter alphanumeric code (A-Z, 0-9)

Props

OtpInput

PropTypeDefaultDescription
maxLengthnumberMaximum number of characters (required)
valuestringControlled value
onChange(value: string) => voidCalled when the value changes
disabledbooleanfalseDisables all input slots
patternRegExp/^[0-9]$/RegEx pattern for character validation
containerClassNamestringAdditional CSS classes for the container
classNamestringAdditional CSS classes

OtpInput.Group

PropTypeDefaultDescription
classNamestringAdditional CSS classes
childrenReact.ReactNodeOtpInput.Slot components

OtpInput.Slot

PropTypeDefaultDescription
indexnumberPosition index of the slot (required)
classNamestringAdditional CSS classes

OtpInput.Separator

PropTypeDefaultDescription
classNamestringAdditional CSS classes
childrenReact.ReactNodeCustom separator content (defaults to dash icon)
Last updated on