InputOtp beta ​

Used to enter a one-time password (OTP).

Basic Usage ​

Value: 123

Custom Length ​

The length of the input fields can be customized by setting the length prop.

Types ​

There are three types available: outlined (default), filled, and underlined.

Outlined (Default)

Filled

Underlined

Sizes ​

There are three sizes available: large, default, and small.

Large

Default

Small

Disabled & Readonly ​

Disabled and readonly states are supported.

Disabled

Readonly

Mask ​

Use the mask prop to hide the input characters.

Value: 123

Separator ​

Customize the separator between OTP fields.

/////
——
•••••

Custom Validation ​

Set the validator prop to validate the input character, and use inputmode to specify the keyboard type.

Numbers only

Letters only

API ​

Attributes ​

NameDescriptionTypeDefault
model-value / v-modelThe value of the OTP fields. Since numbers must not have leading zeros, modelValue is allowed to be a number only during initialization.string / numberundefined
lengthThe OTP fields lengthnumber6
validatorCustom validator functionFunction() => true
inputmodeNative inputmode attributestring—
typeThe type of the OTP fieldsenum'outlined'
sizeThe size of the OTP fieldsenum—
maskWhether to enable password modeboolean—
disabledWhether the OTP fields are disabledbooleanundefined
separatorThe separator between OTP fieldsstring / VNode / Function—
validate-eventWhether to trigger form validationbooleantrue
readonlySame as readonly in native inputbooleanfalse
idNative id attributestring—
aria-label a11yNative aria-label attributestring—

Events ​

NameDescriptionType
update:modelValueTriggers when value updatesFunction
changeTriggers when the value changes after input blurFunction
finishFires when all fields have been filledFunction
focusTriggers when input is focusedFunction
blurTriggers when input is blurredFunction

Slots ​

NameDescriptionType
separatorThe separator between OTP fieldsobject

Exposes ​

NameDescriptionType
inputRefsHTML input elements arrayobject
focusFocus an OTP input fieldFunction
blurBlur the focused OTP input fieldFunction

Source ​

Component • Style • Docs

Contributors ​