OGE logoOGE

OTP Input

A one-time-code / PIN field — Kendo's OTP Input, PrimeNG's InputOtp: length single-character cells in one labelled role="group", each cell named "Character n of m", with a single Tab stop on the caret cell. Typing advances, Backspace steps back, Delete closes the gap and a paste — or the SMS autofill through autocomplete="one-time-code" — fills every cell. The value is always the contiguous characters entered, so value.length === length means complete.

Works standalone via [(value)], with Signal Forms via [formField], and with reactive/template forms via formControl/ngModel.

one-time-code paste autofill forms

Getting started

Type, paste or let the browser autofill the code. Arrows (RTL-mirrored) and Home/End move between cells, Backspace clears and steps back; (completed) fires once every cell holds a character.

value completed autocomplete=one-time-code
Verification code
We sent a 6-digit code to your phone.

Value: · Waiting for the code

Character types and groups

type accepts 'numeric' (script and full-width digits fold to ASCII), 'alphanumeric' or 'alphabetic'; rejected characters never land. letterCase upper- or lower-cases letters and groupSize draws a decorative separator.

type letterCase groupSize
Licence key

Value:

Masked PIN

masked hides the characters like a password field; placeholder marks the empty cells and size picks the cell scale.

masked placeholder size
PIN

Inside a form

A FormValueControl and a ControlValueAccessor: formControl, ngModel and [formField] all bind it. Because the value is the contiguous characters entered, a length validator means "complete".

formControl Validators.minLength
Code

Valid: false