Skip to content

Pin Input

SPinInput is a code input split into cells (OTP, PIN, a code from a text message). It is built on Reka UI (auto-advance between cells, pasting the whole code, keyboard control) and reuses SFormField for the label, hint, error message and a11y wiring. The value is an array of characters bound with v-model.

Basic usage

Masked input

mask hides the characters — for secret PIN codes.

States

required marks the field as required, error shows an error message and makes the field invalid (explicit invalid does the same), disabled blocks input.

OTP and placeholder

otp enables autofill of a code from a text message on mobile devices, and placeholder sets the filler character for empty cells.

prepend / append slots

The slots put arbitrary content next to the code cells — an icon or a caption.

API

Props

NameTypeDefaultDescription
idstringundefinedControl id. Generated automatically when not set (SSR-safe).
labelstringundefinedField label.
hintstringundefinedHint below the field.
errorstringundefinedError message. When set, the field is marked invalid.
invalidbooleanfalseExplicitly marks the field invalid (in addition to error).
squarebooleanundefinedSquare corners: removes the cell border radius (rounded by default).
requiredbooleanfalseMarks the field as required.
disabledbooleanfalseDisables input.
lengthnumber4Number of code cells.
type"number" | "text""text"Input type: text or number (digits only).
maskbooleanfalseHides the entered characters (for secret codes).
otpbooleanfalseOne-time code (OTP) mode: autofill from SMS or the clipboard on mobile.
placeholderstringundefinedPlaceholder character for empty cells.
model-valuestring[][]The entered code as an array of characters, one per cell. Two-way bound via v-model. With type="number", Reka puts numbers into the elements at runtime, so convert values to the type you need when reading them (String(v) / Number(v)).

Events

NameSignatureDescription
update:modelValue(value: string[]) => voidEmitted when modelValue changes. Used for two-way binding (v-model).

Slots

NameDescription
prependContent at the start of the field, inside the border (icon, button).
appendContent at the end of the field, inside the border (icon, button).