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

@mani_kan_dan_al/pinotp

v0.1.5

Published

A modern, customizable React OTP / PIN input component

Readme

pinotp — React OTP / PIN input component

pinotp is a small, accessible, and customizable React component for entering OTPs or PINs. It focuses on a good developer experience and ships with a minimal build setup.

Features

  • Lightweight and focused on PIN/OTP entry
  • Works with React 18+ / 19+
  • Customizable styles and behavior

Installation

Install the package and add React as a peer dependency in your project (React is a peer dependency of this package):

npm install @mani_kan_dan_al/pinotp

Usage

Import the component in your React app. The package exports a default OTPInput component.

Minimal Example

import React from "react";
import { OTPInput } from "@mani_kan_dan_al/pinotp";

export default function Example() {
  const [value, setValue] = React.useState("");
  return <OTPInput length={6} value={value} onChange={setValue} />;
}

Full Example with All Main Props

import React, { useState } from "react";
import { OTPInput } from "@mani_kan_dan_al/pinotp";

export default function FullOTPExample() {
  const [otp, setOtp] = useState("");
  const [error, setError] = useState(false);
  const [completed, setCompleted] = useState(false);

  const handleChange = (val) => {
    setOtp(val);
    setError(false);
    setCompleted(false);
  };

  const handleComplete = (val) => {
    setCompleted(true);
    // Example: check OTP value
    if (val !== "123456") {
      setError(true);
    } else {
      alert("OTP correct!");
    }
  };

  return (
    <div style={{ maxWidth: 400, margin: "2rem auto", textAlign: "center" }}>
      <h2>Enter OTP</h2>
      <OTPInput
        length={6}
        value={otp}
        onChange={handleChange}
        onComplete={handleComplete}
        autoFocus={true}
        mask={false}
        shape="box" // box | circle | underline
        size={48}
        gap={10}
        colors={{
          border: "#ccc",
          focus: "#0070f3",
          text: "#222",
          background: "#fff",
          error: "#e00",
        }}
        error={error}
      />
      {error && (
        <div style={{ color: "#e00", marginTop: 8 }}>
          Invalid OTP. Try 123456.
        </div>
      )}
      {completed && !error && (
        <div style={{ color: "#090", marginTop: 8 }}>OTP complete!</div>
      )}
      <button
        style={{ marginTop: 16 }}
        onClick={() => handleComplete(otp)}
        disabled={otp.length !== 6}
      >
        Submit
      </button>
    </div>
  );
}

Author

Manikandan

Notes

  • React and React DOM are declared as peerDependencies — consumers must install them in their projects.
  • The package builds ESM and CommonJS bundles into ./dist and the prepare/prepublishOnly scripts run the build automatically.

Contributing

PRs are welcome. Open an issue or submit a pull request with suggested improvements.

License

MIT — see the LICENSE file.