OtpInput
A one-time code split into boxes. Typing moves to the next box, Backspace goes back, the arrows, Home and End move, and a paste (or the phone offering the code from a text message, via autocomplete="one-time-code") fills every box at once. The boxes sit in a <fieldset> named by its legend, each is labelled "Digit 2 of 6", and the error is linked to every box with aria-describedby. Emits complete when the last box is filled.
Install: pnpm add-component Fields/OtpInput
Basic usage
Type a digit and focus moves on. Paste 123456 into any box to fill them all; complete fires with the code.
Letters and numbers
inputmode="text" accepts letters too, for voucher and pairing codes.
Error
The message says how to fix it. In AppForm, type: "otp" fills it from the schema; length and inputmode pass through.
API
modelValue(string): The code typed so far (use v-model).length(number): Number of boxes.label(string): The legend, which names the group.description(string): Help below the boxes, linked to each one.error(string): Shown below with an icon; every box gets a danger edge, aria-invalid and aria-describedby.inputmode('numeric' | 'text'): numeric takes digits only and opens the number pad; text takes letters and digits and names the boxes "Character n of N".disabled(boolean): Disables the fieldset.name(string): Native name prefix; each box posts as name-1, name-2 and so on.