Input OTP

One-time password input with individual digit slots, auto-advance, paste support, and mask mode.

InputTypeDefaultDescription
lengthnumber6Total number of OTP digits
separatornumber0Position to insert a dash separator
disabledbooleanfalseDisable all slots
maskbooleanfalseMask input with dots
valuestring''Two-way bound OTP value

Import & Usage

typescript
import { Component, signal } from '@angular/core';
import { NgOatInputOtp } from '@letsprogram/ng-oat';

@Component({
  selector: 'app-example',
  imports: [NgOatInputOtp],
  template: `
    <ng-oat-input-otp
      [length]="6"
      [separator]="3"
      [(value)]="otpCode" />
  `,
})
export class ExampleComponent {
  otpCode = signal('');
}

Basic (6 digits)

Value: (empty)

html
<ng-oat-input-otp [(value)]="otpValue" />

With Separator

Value: (empty)

html
<ng-oat-input-otp [length]="6" [separator]="3" [(value)]="otpCode" />

4-digit PIN

Value: (empty)

html
<ng-oat-input-otp [length]="4" [mask]="true" [(value)]="pin" />

Disabled

html
<ng-oat-input-otp [length]="6" [disabled]="true" value="123456" />