Forms / OTP field

Forms

OTP field

A one-time code, one box per digit, in four, five or six digits.

import { EcoOtpField } from "vue-ecosphere"

Six digits

Typing advances, Backspace goes back, and pasting a code fills every box.

Verification code

We sent it to +91 98••• •••21.

Value: "428" · Completed: —

Four digits

PIN

Five, grouped

Access code

Wrong code

Always offer a way to send another.

Verification code

That code has expired. Send a new one.

API

NameTypeDefaultDescription
v-modelstring""The digits entered so far.
length4 | 5 | 66One box per digit, so the length is visible before typing.
size"md" | "sm""md"Smaller boxes (otp--sm).
groupAfternumber—Put an otp__sep after this many digits.
error / invalidstring / boolean—The whole group turns is-invalid: a wrong code is wrong as a whole.
label / required / hint / first / disabled——Field props. Say where the code went in the hint, masked.
groupLabelstring"Verification code"Group name when there is no label.
@complete(code: string) => void—Every box is filled (typing or paste).