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.
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.
<IPinInput v-model="code" otp />Sizes
Invalid
That code has expired.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue | string | '' | The code, as a plain string |
length | number | 6 | How many cells |
type | 'text' | 'number' | 'text' | number gets the numeric keypad and rejects non-digits |
mask | boolean | false | Render entries as dots |
otp | boolean | false | Advertise the field for one-time-code autofill |
placeholder | string | — | Character shown in an empty cell |
groupSize | number | — | Separator after every N cells |
separator | string | '–' | What that separator shows |
disabled | boolean | false | |
invalid | boolean | false | |
size | 'sm' | 'md' | 'lg' | 'md' | |
unstyled | boolean | — | Skip built-in classes |
ui | { root?, input?, separator? } | — | Per-slot class overrides |
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue | string | On every change |
complete | string | Once every cell is filled |
Slots
| Slot | Description |
|---|---|
separator | Replaces 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.