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

@devotp/react-ui

v1.0.0

Published

Headless React components for OTP verification. Provides UI only with zero API calls -- usable with any backend.

Readme

@devotp/react-ui

Headless React components for OTP verification. Provides UI only with zero API calls -- usable with any backend.

Installation

npm install @devotp/react-ui
# or
bun add @devotp/react-ui

Peer Dependencies

  • react >= 18
  • react-dom >= 18

Quick Start

import { DevOtp } from "@devotp/react-ui";
import type { RequestOtpResponse, ValidateOtpResponse, ResendOtpResponse } from "@devotp/react-ui";

function App() {
  return (
    <DevOtp
      identifierType="both"
      onRequestOtp={async (identifier, type) => {
        const res = await fetch("/api/otp/send", {
          method: "POST",
          body: JSON.stringify({ identifier, type }),
        });
        return (await res.json()) as RequestOtpResponse;
      }}
      onValidateOtp={async (identifier, otp) => {
        const res = await fetch("/api/otp/verify", {
          method: "POST",
          body: JSON.stringify({ identifier, otp }),
        });
        return (await res.json()) as ValidateOtpResponse;
      }}
      onResendOtp={async (identifier) => {
        const res = await fetch("/api/otp/resend", {
          method: "POST",
          body: JSON.stringify({ identifier }),
        });
        return (await res.json()) as ResendOtpResponse;
      }}
      onSuccess={(data) => console.log("Verified!", data)}
    />
  );
}

Components

| Export | Description | |--------|-------------| | DevOtp | All-in-one compound component (identifier inputs + OTP modal) | | DevOtpProvider | Context provider for building custom layouts | | IdentifierStep | Email/phone input fields with verify buttons | | OtpModal | OTP verification modal dialog | | OtpInputBoxes | Individual OTP digit input boxes | | CountrySelector | Country code dropdown for phone inputs |

Hooks

| Export | Description | |--------|-------------| | useDevOtp | Access context state and actions from any child component | | useDevOtpContext | Same as useDevOtp (alias) |

Props (DevOtpProps)

| Prop | Type | Default | Description | |------|------|---------|-------------| | identifierType | "email" \| "phone" \| "both" | "both" | Which input(s) to render | | otpLength | number | 6 | Number of OTP digit boxes | | resendCooldown | number | 30 | Resend cooldown in seconds | | onRequestOtp | (id, type) => Promise<RequestOtpResponse> | required | Send OTP handler | | onValidateOtp | (id, otp) => Promise<ValidateOtpResponse> | required | Verify OTP handler | | onResendOtp | (id) => Promise<ResendOtpResponse> | required | Resend OTP handler | | onSuccess | (data: ValidateOtpResponse) => void | -- | Fires after all identifiers verified | | onError | (error: Error) => void | -- | Error callback | | texts | DevOtpTexts | -- | Override labels and button text | | classNames | DevOtpClassNames | -- | CSS class overrides per slot | | styles | DevOtpStyles | -- | Inline style overrides per slot | | validate | DevOtpValidate \| false | built-in | Custom validators or false to disable | | renderIdentifierInput | (props) => ReactNode | -- | Custom identifier input render prop | | renderOtpInput | (props) => ReactNode | -- | Custom OTP input render prop | | autoFocusOtp | boolean | true | Auto-focus first OTP box on modal open | | showCountrySelector | boolean | false | Show country code dropdown | | defaultCountry | string | -- | Default country (ISO 3166-1 alpha-2) | | countryData | Record<string, CountryData> | built-in | Override country data | | onCountryChange | (country: CountryData) => void | -- | Country selection callback |

Customization

Inline Styles

Pass a styles object with keys matching component slots (container, input, verifyButton, modalOverlay, otpInputBox, etc.).

CSS Classes

Pass a classNames object with the same slot keys to apply your own CSS classes.

Text Overrides

Pass a texts object to customize labels, placeholders, and button text.

Render Props

Use renderIdentifierInput and renderOtpInput for fully custom input components while keeping all state management.

Additional Exports

  • defaultStyles -- the built-in default style object
  • All shared types are re-exported from @devotp/shared for convenience