Rxova
Skip to content

UseOtpInputResult

baseId: string;

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


clear: () => void;

Reset to empty and refocus.

void


focus: () => void;

Focus the underlying input.

void


getContainerProps: (props?) => HTMLAttributes<HTMLDivElement>;
ParameterType
props?HTMLAttributes<HTMLDivElement>

HTMLAttributes<HTMLDivElement>


getInputProps: (props?) => InputHTMLAttributes<HTMLInputElement> & object;
ParameterType
props?InputHTMLAttributes<HTMLInputElement>

InputHTMLAttributes<HTMLInputElement> & object


getSlotProps: (index, props?) => HTMLAttributes<HTMLDivElement>;
ParameterType
indexnumber
props?HTMLAttributes<HTMLDivElement>

HTMLAttributes<HTMLDivElement>


inputRef: object;

Structural rather than RefObject: in @types/react 18 RefObject.current is readonly, in 19 it is mutable. Declaring the shape keeps this assignable under both, which matters because react >= 18 is the peer.

current: HTMLInputElement | null;

isComplete: boolean;

value.length === length.


isFocused: boolean;

The underlying input holds focus.


length: number;

Slot count after normalization.


setValue: (value) => void;

Commit a value programmatically (sanitized like any other input). Used by WebOTP autofill.

ParameterType
valuestring

void


slots: OtpSlotState[];

Per-slot state, in order.


value: string;

The current sanitized value.