Skip to content

Props and Demo Examples

This page demonstrates usage of props and events provided by HOtpInput.

Props & Events

NameTypeDefaultDescription
lengthNumber6Number of OTP inputs to be rendered.
defaultColorString#eeeeeeDefault outline and border color of each OTP input
mainColorString#00dc82Main color for outlined and border when input is focused.
fontColorStringblackColor for input text.
allowPasteBooleantrueIf true, this will allow you paste content from clipboard to OTP input.
onlyNumberBooleantrueIf true, you can only input number to OPT input.
typeString"password", "text"Specific type of OTP input.
autoFocusBooleantrueWhether or not to auto focus on first element on mount.
disabledBooleanfalseWhether or not to disable the input.
outlinedBooleanfalseWhether or not to switch to outlined input.
readonlyBooleanfalseWhether or not to switch to readonly input.
wrapperClassNameStringnullThe class name to use for the wrapper element.
inputClassNameStringnullThe class name to use for each input element.
onChangeFunctionnullCallback event that return OTP code when we made a change in inputs. (otpCode: string)
onFinishFunctionnullCallback event that return OTP code when we fully typed all inputs. (otpCode: string)
separatorStringnullSeparator to be rendered.
separatorTypeString"middle", "all"Default separator position if separator is not null
genResultWithSeparatorFunctionnullUsing this event, exposed from otp component to get code with separator
See the Vue3 Simple OTP Input package for more information.

Demo Examples

Here we display a list of settings that could be applied within an application.








Change OTP Length to 4 or Change OTP Length to 6

The final OTP code is:
The OTP changed to:
The OTP with separator: (get code by calling genResultWithSeparator() exposed from otp component)

Released under the MIT License.