<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/monokai-sublime.min.css" integrity="sha512-ade8vHOXH67Cm9z/U2vBpckPD1Enhdxl3N05ChXyFx5xikfqggrK4RrEele+VWY/iaZyfk7Bhk6CyZvlh7+5JQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
🌾 ng-oatv0.6.0Angular UI library

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/input-otp';

@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" />