Rxova
Skip to content

OtpInputProps

optional aria-describedby?: string;

id(s) of external error/help text.


optional aria-label?: string;

optional autoComplete?: string;

The attribute that unlocks iOS/Android SMS suggestions.

'one-time-code'

optional autoFocus?: boolean;

optional blurOnComplete?: boolean;

Blur the input once complete (dismisses the mobile keyboard).

false

optional children?: ReactNode;

optional className?: string;

optional defaultValue?: string;

Uncontrolled initial value. Ignored when value is provided.


optional dir?: "ltr" | "rtl";

optional disabled?: boolean;

optional id?: string;

Base id; slots derive ${id}-slot-0, …


optional inputRef?: Ref<HTMLInputElement>;

Ref to the underlying <input>.


optional invalid?: boolean;

Sets aria-invalid and data-invalid.


optional label?: string;

Accessible name for the field.


optional length?: number;

Number of slots. Positive integer.

6

optional mask?: string | boolean;

Render a mask char instead of the value (sensitive codes). true -> ’•’.


optional mode?: OtpMode;

Drives inputMode, pattern, autoCapitalize.

'numeric'

optional name?: string;

Posts natively in a <form> and is the name RHF/Formik bind to.


optional nonce?: string;

CSP nonce applied to any injected style.


optional onBlur?: (event) => void;

Fires when focus leaves the whole control, never between slots.

ParameterType
eventFocusEvent<HTMLInputElement>

void


optional onChange?: (value) => void;

Emits the sanitized string (not an event).

ParameterType
valuestring

void


optional onComplete?: (value) => void;

Fires once the value reaches length. The only completion hook — the library never calls form.requestSubmit() for you; wire submit/verify here.

ParameterType
valuestring

void


optional pasteTransform?: (pasted) => string;

Clean pasted text before distributing.

ParameterType
pastedstring

string

strips whitespace and - . _ separators


optional pattern?: string | RegExp;

Override the allowed-character test (per char). Beats mode when set.


optional placeholder?: string;

Per-slot placeholder shown while empty.


optional readOnly?: boolean;

optional render?: (ctx) => ReactNode;

Tier 3 escape hatch. Ignored when children are provided.

ParameterType
ctxOtpRenderContext

ReactNode


optional required?: boolean;

optional slotInteraction?: OtpSlotInteraction;

‘spatial’ = tap any slot to edit it (auto-degrades to ‘crush’ on iOS, which cannot fully hide ::selection); ‘crush’ = collapsed-input behaviour everywhere.

'spatial'

optional style?: CSSProperties;

optional transform?: (value) => string;

Normalize each committed value (e.g. s => s.toUpperCase()). Applied after pattern.

ParameterType
valuestring

string


optional value?: string;

Controlled value. Sanitized to allowed chars and clamped to length; never throws.


optional webOTP?: boolean;

Opt into the WebOTP API (Android Chrome): programmatic SMS retrieval + AbortController cleanup. Layered on top of autocomplete, never instead of it.

false