Skip to content

Forms

IPinInput

One cell per character, for a short code — two-factor, an email confirmation, a door PIN. For anything longer or free-form, use a plain IInput.

Value: —

The model is a string

The cells are joined for you, so the model holds the code as it appears everywhere else in the app.

ts
const code = ref('') // → '123456', not ['1','2','3','4','5','6']

Completion

complete fires the moment the last cell is filled — the natural point to submit.

Submitted: —

Grouping

group-size breaks a long code into chunks, which makes it easier to check against the one the reader is copying.

The separator defaults to an en dash. Pass separator for something else, or use the separator slot for a custom element.

Masked

mask renders each entry as a dot, for a PIN the reader is expected to keep.

Autofill

Set otp and the cells advertise themselves as a one-time code, so a phone can offer the code straight from the SMS that carried it.

vue
<IPinInput v-model="code" otp />

Sizes

Invalid

That code has expired.

Props

PropTypeDefaultDescription
modelValuestring''The code, as a plain string
lengthnumber6How many cells
type'text' | 'number''text'number gets the numeric keypad and rejects non-digits
maskbooleanfalseRender entries as dots
otpbooleanfalseAdvertise the field for one-time-code autofill
placeholderstringCharacter shown in an empty cell
groupSizenumberSeparator after every N cells
separatorstring'–'What that separator shows
disabledbooleanfalse
invalidbooleanfalse
size'sm' | 'md' | 'lg''md'
unstyledbooleanSkip built-in classes
ui{ root?, input?, separator? }Per-slot class overrides

Events

EventPayloadDescription
update:modelValuestringOn every change
completestringOnce every cell is filled

Slots

SlotDescription
separatorReplaces the separator between groups

Accessibility

Each cell names its own position — "pin input 3 of 6". Typing advances to the next cell, Backspace steps back, arrow keys move between cells, and pasting a whole code fills the row in one go. The separators are hidden from assistive technology.