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.

COneTimePassword#

import { COneTimePassword } from '@coreui/react'
// or
import COneTimePassword from '@coreui/react/src/components/one-time-password-input/COneTimePassword'
PropertyDefaultType
ariaLabel#(index: number, total: number) => `Digit ${index + 1} of ${total}(index: number, total: number) => string

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

autoSubmit#falseboolean

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

className#-string

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

defaultValue#-string, number

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

disabled#falseboolean

Disable all one time password (OTP) input fields.

feedback#4.2.0+-ReactNode

Provide valuable, actionable feedback.

feedbackInvalid#4.2.0+-ReactNode

Provide valuable, actionable feedback.

feedbackValid#4.2.0+-ReactNode

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

floatingClassName#4.5.0+-string

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

floatingLabel#4.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

ID attribute for the hidden input field.

invalid#-boolean

Set component validation state to invalid.

label#4.2.0+-ReactNode

Add a caption for a component.

linear#trueboolean

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

masked#falseboolean

Show input as password (masked characters).

name#-string

Name attribute for the hidden input field.

onChange#-(value: string) => void

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

onComplete#-(value: string) => void

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

placeholder#-string

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

readOnly#falseboolean

Make React.js OTP input component read-only.

required#falseboolean

Makes the input field required for form validation.

size#-'sm', 'lg'

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

text#4.2.0+-ReactNode

Add helper text to the component.

tooltipFeedback#4.2.0+-boolean

Display validation feedback in a styled tooltip.

type#number'number', 'text'

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

valid#-boolean

Set component validation state to valid.

value#-string, number

Current value for controlled OTP input.

COneTimePasswordInput#

import { COneTimePasswordInput } from '@coreui/react'
// or
import COneTimePasswordInput from '@coreui/react/src/components/one-time-password-input/COneTimePasswordInput'
PropertyDefaultType
className#-string

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