Components

InputOtp

OTP code input with segmented cells for verification codes.

iOSAndroid
Preview InputOtp on your device

Scan with Expo Go

Download Expo Go, then scan the QR code to preview native components.

Installation

pnpm dlx @docyrus/cli add @docyrus/rn-input-otp

Usage

import { InputOtp } from '@/components/docyrus-native/input-otp';

<InputOtp value={code} onValueChange={setCode} onComplete={handleVerify} />
<InputOtp length={4} mask />

API Reference

PropTypeDefaultDescription
valuestring''Current OTP value
onValueChange(value: string) => void—Value change handler
onComplete(value: string) => void—Called when all digits are entered
lengthnumber6Number of digits
size'sm' | 'md' | 'lg''md'Cell size
disabledbooleanfalseDisable interaction
invalidbooleanfalseShow invalid state
maskbooleanfalseMask entered digits
classNamestring—Additional CSS classes
cellClassNamestring—Individual cell CSS classes
textClassNamestring—Digit text CSS classes
accessibilityLabelstring—Accessibility label

Type Exports

TypeDescription
InputOtpPropsProps for InputOtp component
InputOtpSize'sm' | 'md' | 'lg'

On this page