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

inaivia-react-button-lib

v1.0.0

Published

A reusable React component library built with Vite, TypeScript, and dts.

Downloads

20

Readme

Reusable React Component Library

This is a complete template for creating a reusable React component library, bundled with Vite (in Library mode), using TypeScript, and auto-generating type declarations (.d.ts files).


🚀 How to Set Up and Build

1. Install Dependencies

Run this in the project directory:

npm install

2. Build the Library

Compile your React components and output the build to the dist folder:

npm run build

This compiles your components into two main bundle formats in dist/:

  • ES Modules (my-react-button.es.js): For modern bundlers like Vite, Webpack 5, etc.
  • UMD (my-react-button.umd.js): For compatibility with CommonJS and legacy environments.
  • Type Declarations (index.d.ts): Autogenerated typescript definitions.
  • CSS (style.css): Shared component styles.

📦 How to Publish to npm

To publish this library to the npm registry so anyone (or your private team) can import it, follow these steps:

Step 1: Create an npm account

If you don't have one, sign up on npmjs.com.

Step 2: Log in via your terminal

Run the following command and follow the prompt:

npm login

Step 3: Choose a unique package name

Open package.json and change the "name" property to a unique package name.

  • Tip: You can use scoped packages like @your-username/my-button to avoid naming conflicts on npm.

Step 4: Publish it!

Run:

npm publish

(If you are using a scoped package like @username/my-button, publish it with public access using: npm publish --access public)


🔌 How to Import & Use it in another project

Once published, install it in any other React project:

npm install my-react-component-library

Then, import and use it in your code:

import React from 'react';
import { Button } from 'my-react-component-library';
import 'my-react-component-library/dist/style.css'; // Import the component styles

export default function App() {
  return (
    <div>
      <Button 
        variant="primary" 
        size="large" 
        label="Click Me!" 
        onClick={() => alert("It works!")} 
      />
    </div>
  );
}

🛠️ Testing Locally Before Publishing

You don't have to publish to npm to test it! You can install it locally in another project:

  1. In your library project directory, run:
    npm link
  2. In your target app project directory, run:
    npm link my-react-component-library

Now, any changes you make and build will be instantly reflected in your test app.