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

otp-angular

v1.1.0

Published

**Otp Angular** is a lightweight, highly customizable, and dependency-free OTP (One-Time Password) input component built for Angular 20+ applications. It offers seamless integration, flexible configuration, and a polished user experience for OTP or verifi

Readme

🔐 OTP Angular

Otp Angular is a lightweight, highly customizable, and dependency-free OTP (One-Time Password) input component built for Angular 20+ applications. It offers seamless integration, flexible configuration, and a polished user experience for OTP or verification inputs. The component now also includes a built-in resend option, making it easy to handle OTP resubmission flows directly within the UI.

✅ Supports Angular 20+
🔧 Fully customizable
🎯 Keyboard navigation support
🧪 Easily testable & maintainable
💡 Auto-focus, password-style, number-only, and more


OTP Input Demo

Demo

📦 Installation

npm install otp-angular

🚀 Latest changes in 1.1.0

  • Update Auto Submit Improved autoSubmit functionality

  • Bug Fix Fixed form control value update issue on Backspace delete

Usage

For Component

import { OtpAngular, OtpAngularType } from 'otp-angular';

@Component({
  imports: [...others, OtpAngular, OtpAngularType]
})

export class <ComponentName> {
  protected config = signal<OtpAngularType>({ length: 4 });
}

For Template

@let _config = config();
<!-- With Event Binding -->
<otp-angular [config]="_config" (onInputChange)="onInputChange($event)"  (onResendAvailable)="resend($event)" />

<!-- Using Reactive FormControl -->
<otp-angular [config]="_config" formControlName="otp" />

<!-- Using Forms Module -->
<otp-angular [config]="_config" [(ngModel)]="otp" />

⚙️ Inputs/Outputs

| Option | Type | Required | Description | Default | |---------------------|------------|----------|----------------------------------------------------------------------------------|----------------| | disabled | boolean | No | Disables the OTP input when set to true | false | | onInputChange | Output | No | Emits the OTP value on change. Returns string, number, or null | — | | onAutoSubmit | Output | No | Emits the OTP value when all input fields are filled and autoSubmit is enabled | — | | onResendAvailable | Output | No | Emits true when the resend option is clicked | — | | setValue | function | No | Programmatically sets the OTP value | — | | reset | function | No | Resets the resend timer | — | | config | object | Yes | Configuration object for the OTP component (see Config Options below) | { length: 4 }|


⚙️ Config Options

| Option | Type | Required | Description | Default | |--------------------------|--------------------------|----------|-------------------------------------------------------------------------|---------------------------------| | length | number | Yes | Number of OTP digits | 4 | | numbersOnly | boolean | No | Allows only numeric input | false | | autoFocus | boolean | No | Automatically focuses the first input | false | | autoSubmit | boolean | No | Automatically emits the OTP value when all inputs are filled | false | | isPassword | boolean | No | Masks input characters | false | | showError | boolean | No | Shows a red border on empty inputs when blurred | false | | showCaps | boolean | No | Transforms input characters to uppercase | false | | containerClass | string \| string[] | No | Custom CSS class(es) for the container | — | | containerStyles | object | No | Inline styles for the container | {} | | inputClass | string \| string[] | No | Custom CSS class(es) for OTP input fields | — | | inputStyles | object \| object[] | No | Inline styles for OTP input fields | {} | | placeholder | string | No | Placeholder text for each input field | '' | | separator | string | No | Optional separator character between inputs | '' | | resend | number | No | Enables the resend option with countdown (in seconds) | 0 | | resendLabel | string | No | Text label for the resend option | RESEND VERIFICATION CODE | | resendContainerClass | string | No | Custom CSS class for the resend container | '' | | resendLabelClass | string | No | Custom CSS class for the resend label | '' | | resendTimerClass | string | No | Custom CSS class for the resend timer | '' | | theme | 'light' \| 'dark' | No | Theme color mode | 'light' |


🧩 Other Features

Use @ViewChild to get a reference to the component

@ViewChild(OtpAngular, { static: false }) otpRef!: OtpAngular;

🔒 Disabling Inputs

You can disable all input fields using the disabled input or programmatically:

this.otpRef.disabled.set(true);

🔁 Updating OTP Value

this.otpRef.setValue('1234');

🔁 Reset the timer of resend

this.otpRef.reset();

📛 Badges

npm npm GitHub issues GitHub stars


📄 License

License: MIT