React One Time Password Input Component API

One Time Password Input API

Explore the API reference for the React One Time Password Input components and discover how to effectively utilize their props for customization.

On this page

COneTimePassword

jsx
import { COneTimePassword } from '@coreui/react-pro'
PropertyDefaultType
ariaLabel(index: number, total: number) => `Digit ${index + 1} of ${total}`((index: number, total: number) => string), undefined

Function to generate aria-label for each input field. Receives current index (0-based) and total number of inputs.

autoSubmit-boolean, undefined

Automatically submit the form when all one time password fields are filled.

className-string, undefined

A string of all className you want applied to the React.js OTP component.

defaultValue-string, number, undefined

Initial value for uncontrolled React.js one time password input.

disabled-boolean, undefined

Disable all one time password (OTP) input fields.

feedback4.2.0+-ReactNode

Provide valuable, actionable feedback.

feedbackInvalid4.2.0+-ReactNode

Provide valuable, actionable feedback.

feedbackValid4.2.0+-ReactNode

Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, :invalid and :valid.

floatingClassName4.5.0+-string, undefined

A string of all className you want applied to the floating label wrapper.

floatingLabel4.2.0+-ReactNode

Provide valuable, actionable valid feedback when using standard HTML form validation which applied two CSS pseudo-classes, :invalid and :valid.

id-string, undefined

ID attribute for the hidden input field.

invalid-boolean, undefined

Set component validation state to invalid.

label4.2.0+-ReactNode

Add a caption for a component.

lineartrueboolean, undefined

Enforce sequential input (users must fill fields in order).

masked-boolean, undefined

Show input as password (masked characters).

name-string, undefined

Name attribute for the hidden input field.

onChange-((value: string) => void), undefined

Callback triggered when the React.js one time password (OTP) value changes.

onComplete-((value: string) => void), undefined

Callback triggered when all React.js one time password (OTP) fields are filled.

placeholder-string, undefined

Placeholder text for input fields. Single character applies to all fields, longer strings apply character-by-character.

readOnly-boolean, undefined

Make React.js OTP input component read-only.

required-boolean, undefined

Makes the input field required for form validation.

size-'sm', 'lg', undefined

Sets the visual size of the React.js one time password (OTP) input. Use 'sm' for small or 'lg' for large input fields.

text4.2.0+-ReactNode

Add helper text to the component.

tooltipFeedback4.2.0+-boolean, undefined

Display validation feedback in a styled tooltip.

typenumber'number', 'text', undefined

Input validation type: 'number' for digits only, or 'text' for free text.

valid-boolean, undefined

Set component validation state to valid.

value-string, number, undefined

Current value for controlled OTP input.

COneTimePasswordInput

jsx
import { COneTimePasswordInput } from '@coreui/react-pro'
PropertyDefaultType
className-string, undefined

A string of all className you want applied to the component.