InputOtp API

API documentation for InputOtp component

InputOtp#

Props#

Defines valid properties in InputOtp component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputOtpInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: InputOtpInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<InputOtpPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: InputOtpInstance) => ReactNode)
null
The children to render.
size"small" | "large"
null
Defines the size of the InputText.
variant"outlined" | "filled"
null
Specifies the input variant of the component.
disabledboolean
false
When present, it specifies that the element should be disabled.
valuestring
null
Specifies whether a inputotp should be checked or not.
defaultValuestring
null
Specifies whether a inputotp should be checked or not.
integerOnlyboolean
false
When present, it specifies that only integers are allowed.
maskboolean
false
Mask pattern.
onValueChange(event: useInputOtpValueChangeEvent) => void
null
Callback to invoke when value changes.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in InputOtp component.

nametypedefaultdescription
valuestring
null
Value of the otp.
tokensstring[]
null
Tokens of the otp.

Exposes#

Defines the methods and properties exposed by InputOtp component.

nametypedefaultdescription
stateuseInputOtpState
null
State of the input OTP.
registerText() => number
null
Register a text input.
inputType() => string
null
Returns the input type based on configuration.
inputMode() => string
null
Returns the input mode for mobile keyboards.
onInput(event: FormEvent<HTMLInputElement>, index: number) => void
null
Input event handler.
onClick(event: MouseEvent<HTMLInputElement>) => void
null
Click event handler.
onKeyDown(event: KeyboardEvent<HTMLInputElement>) => void
null
Key down event handler.
onPaste(event: ClipboardEvent<HTMLInputElement>) => void
null
Paste event handler.

Interfaces#

Defines passthrough(pt) options of InputOtp component.

nametypedefaultdescription
rootInputOtpPassThroughType<InputHTMLAttributes<HTMLInputElement>>
null
Used to pass attributes to the root's DOM element.
textInputOtpPassThroughType<InputHTMLAttributes<HTMLInputElement>>
null
Used to pass attributes to the input's DOM element.

Types#

Instance of InputOtp component.

values
ComponentInstance<InputOtpProps, InputOtpState, InputOtpExposes>

InputOtpText#

Props#

Defines valid properties in InputOtpText component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputOtpTextInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: InputOtpTextInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<InputOtpTextPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: InputOtpTextInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by InputOtpText component.

nametypedefaultdescription
inputotpInputOtpInstance
null
Instance of the InputOtp component.

Interfaces#

Defines passthrough(pt) options of InputOtpText component.

nametypedefaultdescription
rootInputOtpTextPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of InputOtpText component.

values
ComponentInstance<InputOtpTextProps, InputOtpTextState, InputOtpTextExposes>

useInputOtp#

Props#

Defines valid properties in useInputOtp.

nametypedefaultdescription
valuestring
null
Specifies whether a inputotp should be checked or not.
defaultValuestring
null
Specifies whether a inputotp should be checked or not.
integerOnlyboolean
false
When present, it specifies that only integers are allowed.
maskboolean
false
Mask pattern.
onValueChange(event: useInputOtpValueChangeEvent) => void
null
Callback to invoke when value changes.

State#

Defines valid state in useInputOtp.

nametypedefaultdescription
valuestring
null
Value of the otp.
tokensstring[]
null
Tokens of the otp.

Exposes#

Defines the methods and properties exposed by useInputOtp.

nametypedefaultdescription
stateuseInputOtpState
null
State of the input OTP.
registerText() => number
null
Register a text input.
inputType() => string
null
Returns the input type based on configuration.
inputMode() => string
null
Returns the input mode for mobile keyboards.
onInput(event: FormEvent<HTMLInputElement>, index: number) => void
null
Input event handler.
onClick(event: MouseEvent<HTMLInputElement>) => void
null
Click event handler.
onKeyDown(event: KeyboardEvent<HTMLInputElement>) => void
null
Key down event handler.
onPaste(event: ClipboardEvent<HTMLInputElement>) => void
null
Paste event handler.

Events#

Custom value change event.

nametypedescription
originalEventFormEvent<HTMLInputElement>Original browser event.
valuestringNew value.

Types#

Instance of useInputOtp headless.

values
HeadlessInstance<useInputOtpProps, useInputOtpState, useInputOtpExposes>