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 🙏

© 2024 – Pkg Stats / Ryan Hefner

nitro-otp

v1.1.0-ng17

Published

One Time Password (OTP) / PIN Input Angular Library Component for the web

Downloads

56

Readme

@nitro/otp (OTP / PIN Input)

Angular Library - Nitro OTP

Angular Library - Nitro OTP

One Time Password (OTP) Input Angular Library Component for the web built with Angular 17.1.3 and tested from all versions >= 10.0.0.

This can be used as OTP inputs or Personal Identification Number (PIN) inputs or for all each character specific inputs.

If you are facing any issues with lower versions of angular, Please use the previous versions.

Features:

  1. Light weight
  2. Fully customizable
  3. CSS vars for theming
  4. In-Built Boxed & Dashed appearance

Usage

app.module.ts

import { OtpModule } from 'nitro-otp';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    OtpModule
  ]
})

some.component.ts

import { OtpComponent } from 'nitro-otp';

some.component.html

<nitro-otp #otp [size]="4" message="Incorrect OTP" [autoFocus]="true" (otpChange)="afterOtpChanged($event)"></nitro-otp>

Error Management Example:

some.component.ts

// Below code are OPTIONAL for error display
export class SomeComponent {
  @ViewChild('otp')
  private otp!: OtpComponent;

  afterOtpChanged(otpVal: [string, boolean]): void {
    const [value, length] = otpVal;
    // value: Value of OTP Input
    // length: TRUE, if length matches and vice-versa
    
    // Write your validation code here `this.otp.isError.next(true);` will set Error
    this.otp.isError.next(!length);
  }
}

API:

|Name|Type|Default|Description| |---|---|---|---| |appearance|String| legacy | Change Appearance of ControlChange appearance of OTP input (legacy / dashed)Eg.:<nitro-otp [appearance]="dashed"></nitro-otp>Accepted Values:legacy / dashed / <any_string>Custom String will be added as a class prefixed by an underscores (like _customTheme)| |autoFocus|Boolean| true | Autofocus to InputToggle autoFocus to OTP inputEg.:<nitro-otp [autoFocus]="true"></nitro-otp>| |message|String| "" | Message to showCustom message to show when an Error occursEg.:<nitro-otp [message]="'Invalid OTP'"></nitro-otp>| |passwordChar|String| | passwordChar to showCustom Character to mask the OTPEg.:<nitro-otp [passwordChar]="*"></nitro-otp>| |revealChar|Boolean| true | Set the Characters Reveal or NotSet Character to mask or show for OTPEg.:<nitro-otp [revealChar]="true"></nitro-otp>| |size|Number| 4 | Max. Size of InputDefines the maximum size of OTP / Pin Input ControlEg.:<nitro-otp [size]="4"></nitro-otp>|

CSS Variables:

:root {
  --nitro-otp_border-color: goldenrod;
  --nitro-otp_border-color_focus: blue;
  --nitro-otp_border-color_error: red;
}

This library was generated with Angular CLI version 17.1.3.