npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ngx-otp-pin-input

v1.0.2

Published

An Angular library for OTP input fields, providing a customizable and user-friendly way to handle one-time passwords.

Downloads

10

Readme

ngx-otp-input

ngx-otp-input is an Angular component for capturing one-time password (OTP) inputs. Perfect for authentication flows, verification forms, or secure user inputs.

ngx-otp-pin-input

Features

  • Configurable OTP length (default: 4 digits)
  • Customizable input styles: size, font, border, spacing
  • Supports keyboard navigation (arrow keys, backspace)
  • Paste support for OTPs
  • Supports Angular Reactive form binding
  • Can be disabled to prevent user input

Installation

npm install ngx-otp-input

Usage

1. Import the Module

Add NgxOtpInput to your application's module imports:

import { NgxOtpInput } from "ngx-otp-input";

@NgModule({
  declarations: [AppComponent],
  imports: [NgxOtpInput], // Add the module here
  bootstrap: [AppComponent],
})
export class AppModule {}

2. Use in Templates

Add the OTP input component to your template:

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  config:OtpInputConfig = {
        length: 6,
        className: 'otp-input',
        style: {
            width: 50,
            height: 50,
            fontSize: 28,
            spacing: 10,
            borderWidth: 2,
            borderRadius: 5,
            borderColor: '#ccc',
            borderFocusColor: '#6200ea'
        }
    }
}
<ngx-otp-input (onOtpChange)="onOtpChange($event)" [config]="config"></ngx-otp-input>

3. Bind with Angular Forms

Works seamlessly with reactive forms or ngModel.

Using formControl:

<form [formGroup]="otpForm">
  <ngx-otp-input formControlName="otp"></ngx-otp-input>
</form>

In your component class:

this.otpForm = this.fb.group({
  otp: [""],
});

Using ngModel:

<ngx-otp-input [(ngModel)]="otpValue" name="otp"></ngx-otp-input>

4. Listen for OTP Changes

Subscribe to onOtpChange to get OTP input updates:

<ngx-otp-input (onOtpChange)="ratingChange($event)"></ngx-otp-input>
onOtpChange(otp: string) {
    console.log('OTP:', otp);
}

5. Disable the Component

Disable input by setting [disabled] to true:

<ngx-otp-input [disabled]="true"></ngx-otp-input>

Input Properties (OtpInputConfig)

| Property | Type | Default | Description | | ---------------------- | ------- | --------- | ------------------------------- | | length | number | 4 | Number of OTP digits | | className | string | | CSS class applied to each input | | style.width | number | 40 | Width of each input box (px) | | style.height | number | 40 | Height of each input box (px) | | style.fontSize | number | 26 | Font size of input text (px) | | style.spacing | number | 12 | Gap between inputs (px) | | style.borderWidth | number | 2 | Border width of inputs (px) | | style.borderRadius | number | 4 | Border radius of inputs (px) | | style.borderColor | string | '#BDBDBD' | Default border color | | style.borderFocusColor | string | '#3700B3' | Border color when focused | | disabled | boolean | false | Disables input interaction |

Output Events

| Event | Type | Description | | ----------- | -------------------- | --------------------------------- | | onOtpChange | EventEmitter | Emits the current OTP input value |

License

This project is licensed under the MIT License. (©) Vipin.

Happy coding! 🚀