Skip to main content
196

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
React Native docs
FormsReact Native

Input OTP

Enter numeric verification codes with native paste and autofill integration.

Public APILumenInputOTPReact Native

Native example

Use Input OTP

The application verifies codes and owns submission. Normalize localized digit input into ASCII; reject invalid or excess input without truncating. Never send or persist credentials from the component.

View captured React Native example
Input OTP rendered in the Expo web renderer Lumen playground
Captured exampleExpo web renderer
tsx
import { useState } from 'react'
import { LumenInputOTP } from '@santi020k/lumen-react-native'

export function VerificationCode() {
  const [code, setCode] = useState('')
  return <LumenInputOTP label="Verification code" value={code} onValueChange={setCode}
    length={6} description="Enter or paste six digits" />
}

Reference

Public API

The primary shared and platform-specific options exposed by LumenInputOTP.

APIValues or typeDefaultDescription
label / value / onValueChangestring / string / (string) => voidRequiredControls at most length ASCII digits; localized edits normalize to ASCII.
lengthnumber6Accepts code lengths from one through twelve.
maskedbooleanfalseHides displayed digits.
onComplete(string) => voidundefinedReports a newly completed edit; the host verifies and submits.
ref / TextInput propsLumenTextInputRef / TextInputPropsundefinedPreserves native paste, selection and focus.
description / errorMessagestringundefinedProvides localized supporting copy or host validation.
enabled / readOnlybooleantrue / falseBlocks changes without clearing controlled state.

Native behavior

Design and accessibility

When to use it

The application verifies codes and owns submission. Normalize localized digit input into ASCII; reject invalid or excess input without truncating. Never send or persist credentials from the component.

Accessibility

Uses one native input for paste, selection, deletion, and SMS code autofill; supports errors and optional masking.

Shared component

Available on other platforms

Apple / SwiftUIAndroid / Compose
React Native docsNative primitives