InputOtp

Input Otp is used to enter one time passwords.

import { InputOtpModule } from 'primeng/inputotp';

Two-way value binding is defined using ngModel. The number of characters is defined with the length property, which is set to 4 by default.

Enable the mask option to hide the values in the input fields.

When integerOnly is present, only integers can be accepted as input.

InputOtp provides small and large sizes as alternatives to the base.

Define a template with your own UI elements with bindings to the provided events and attributes to replace the default design.

InputOtp can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.

A sample UI implementation with templating and additional elements.

Authenticate Your Account

Please enter the code sent to your phone.

Screen Reader

Input OTP uses a set of InputText components, refer to the InputText component for more information about the screen reader support.

Keyboard Support

KeyFunction
tabMoves focus to the input otp.
right arrowMoves focus to the next input element.
left arrowMoves focus to the previous input element.
backspaceDeletes the input and moves focus to the previous input element.
PrimeBlocks
490+ ready to use UI blocks crafted with PrimeNG and Tailwind CSS.