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