InputOTP

Input for authentication or verification where the user can only enter one symbol at time.

Verification

We have sent a code to j***@mail.com. Enter the code below.

-

Import

JSX

Usage

JSX

Variants

Label

Enter PIN
JSX

Description

Verification

We have sent a code to +31 ******27. Enter the code below.

JSX

Separator

-
JSX

Auto Submit

If autoSubmit is true, then the onSubmit callback will be automatically called when every slot has been filled in. If autoSubmit is false, the user has to manually press 'Enter' to submit the code.

Verification

We have sent a code to j***@mail.com. Enter the code below.

-
JSX

Disabled

Enter PIN
JSX

Validation

Letters only

Verification

We have sent a code to +31 ******27. Enter the code below.

JSX

Numbers only

Verification

We have sent a code to +31 ******27. Enter the code below.

JSX

Combination

Verification

We have sent a code to +31 ******27. Enter the code below.

JSX

On Error

It is possible to pass custom errors to InputOTP like network errors, API-errors etc. The key value is mandatory and must be different for each time an error occurs in order to trigger a re-render which will display the error again. The message value can be the same.

Verification

We have sent a code to j***@mail.com. Enter the code below.

-
JSX

Props

InputOTP.Form

PropTypeDefaultDescription
inputLength*number-Amount of slots
errorMessage{message: string, key: string}-Custom error message
onSubmit(string) => Promise<void> | void-Callback function that fires on completion
autoSubmitbooleantrueAutomatically calls onSubmit on completion
disabledbooleanfalseProhibits user from filling in the input
allowNumbersbooleantrueAllow input value to contain numbers
allowLettersbooleantrueAllow input value to contain letters
children*ReactNode-Expecting <InputOTP.Slot> and in if applicable also <InputOTP.Separator>

InputOTP.Slot

PropTypeDefaultDescription
index*number-Which slot in the sequence

InputOTP.Label

PropTypeDefaultDescription
children*string-Label text

InputOTP.Description

PropTypeDefaultDescription
children*string-Description text
*: mandatory props