MindeesUI
ComponentsForms

OTPInput

A segmented one-time-code field driven by a single hidden input for predictable focus and autofill.

OTPInput renders a row of code boxes backed by one hidden TextInput, so there is a single focus target for keyboards and screen readers. It accepts digits only, fires onChangeText as the code grows, and calls onComplete once the code reaches length.

Import

import { OTPInput } from '@mindees/ui';

Usage

<OTPInput length={6} value={code} onChangeText={setCode} onComplete={verify} />

Props

PropTypeDefaultDescription
lengthnumber6Number of code boxes.
valuestringControlled value (the full code so far).
onChangeText(code: string) => voidCalled whenever the code changes.
onComplete(code: string) => voidCalled once when the code reaches length.
secureTextEntrybooleanfalseMask each character with a dot.
disabledbooleanfalseDisable input and dim the boxes.
autoFocusbooleanfalseFocus the hidden input on mount.
accessibilityLabelstringAccessible label for the whole code field.
styleStyleProp<ViewStyle>Style applied to the boxes row container.

Accessibility

The whole field is a single Pressable that focuses the hidden input, labelled One-time code (or PIN code when masked) unless you pass accessibilityLabel. The hidden input uses textContentType="oneTimeCode" so the platform can autofill an SMS code.

On this page