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.
Please enter the code sent to your phone.
Input OTP uses a set of InputText components, refer to the InputText component for more information about the screen reader support.
| Key | Function |
|---|---|
| tab | Moves focus to the input otp. |
| right arrow | Moves focus to the next input element. |
| left arrow | Moves focus to the previous input element. |
| backspace | Deletes the input and moves focus to the previous input element. |