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

react-paginate-js

v1.0.9

Published

A simple ReactJS component for creating pagination.

Readme

🔢 Pagination Component

A fully customizable and reusable pagination component built with React and TypeScript.

This component can be used in any React project (e.g., Vite, CRA, etc.) and is also compatible with Next.js (App Router or Pages Router).

✨ Features

  • ✅ Easy to use with minimal setup
  • 🧩 Custom render functions for page buttons, ellipsis, prev/next
  • 🎨 Style customization with class names
  • ⏭️ Smart ellipsis rendering for large data sets
  • 🔁 Fully controlled component
  • 📦 Lightweight and dependency-free

🚀 Installation

Install the package via npm or yarn:

npm install react-paginate-js

🧪 Basic Usage

import Pagination from "react-paginate-js";

function MyComponent() {
  const [page, setPage] = useState(0);

  return (
    <Pagination currentPage={page} total={100} onChange={(p) => setPage(p)} />
  );
}

⚠️ Next.js Users

If you're using Next.js with the App Router, don’t forget to add the following directive at the top of the component file:

"use client";

⚙️ Props

| Prop name | Type | Default | Description | | ------------------------- | ---------------------------------------- | ------------- | ----------------------------------------------------------------------- | | currentPage | number | 0 | The current active page (0-based index). | | total | number | 0 | Total number of items. | | onChange | (value: number) => void | — | Callback when a new page is selected. | | pageSize | number | 10 | Number of items per page. | | maxVisiblePages | number | 5 | Max number of visible page buttons (excluding first/last and ellipsis). | | className | string | "" | Class for the pagination container. | | buttonClassName | string | "" | Class for all page buttons. | | activeButtonClassName | string | "" | Class for the active page button. | | disabledButtonClassName | string | "" | Class for disabled buttons. | | renderPageButton | (page, isActive, onClick) => ReactNode | Built-in | Custom render function for each page. | | renderEllipsis | () => ReactNode | ... span | Custom ellipsis rendering. | | renderPrevButton | (disabled, onClick) => ReactNode | &lt; button | Custom "Previous" button. | | renderNextButton | (disabled, onClick) => ReactNode | &gt; button | Custom "Next" button. |

💡 Fully Customized Example Using Next.js & Tailwind

"use client";

import { useState } from "react";
import Pagination from "react-paginate-js";

export default function ExamplePage() {
  const [page, setPage] = useState(0);

  return (
    <div>
      <Pagination
        currentPage={page}
        total={50}
        pageSize={5}
        maxVisiblePages={5}
        onChange={(page) => setPage(page)}
        className="flex items-center justify-center gap-2 mt-4"
        buttonClassName="px-3 py-1 border rounded text-gray-700 hover:bg-gray-100"
        activeButtonClassName="bg-blue-500 text-white font-bold"
        disabledButtonClassName="text-gray-400 cursor-not-allowed"
        renderPrevButton={(disabled, onClick) => (
          <button
            disabled={disabled}
            onClick={onClick}
            className={`px-3 py-1 border rounded ${
              disabled ? "text-gray-400" : "hover:bg-gray-100"
            }`}
          >
            Previous
          </button>
        )}
        renderNextButton={(disabled, onClick) => (
          <button
            disabled={disabled}
            onClick={onClick}
            className={`px-3 py-1 border rounded ${
              disabled ? "text-gray-400" : "hover:bg-gray-100"
            }`}
          >
            Next
          </button>
        )}
        renderPageButton={(page, isActive, onClick) => (
          <button
            onClick={onClick}
            className={`px-3 py-1 border rounded ${
              isActive
                ? "bg-blue-500 text-white font-semibold border border-blue-500"
                : "hover:bg-gray-100"
            }`}
          >
            {page + 1}
          </button>
        )}
        renderEllipsis={() => <span className="px-2 text-gray-500">...</span>}
      />
    </div>
  );
}