Skip to main content

React Pagination Library

 I built a very simple react pagination library with TypeScript.



react-awesome-paginate

React awesome paginate is a modern, lightweight, typescript based pagination component. You can use it in your project very easily. There are some predefined theme you can use it, in your component.

NPM

Installation

Install react-awesome-paginate with npm:

npm i react-awesome-paginate --save

Props & Theme demo: Codesandbox

API demo: Codesandbox

Preview

Default theme

Default Pagination preview

Circular theme

Circular Pagination preview

Classic theme

Classic Pagination preview

Compact theme

Compact Pagination preview

Import and Usage rule in your component

import Pagination from 'react-awesome-paginate'; // Import npm module
import 'react-awesome-paginate/dist/index.css'; // Import CSS (You can override css styling easily.)


// In your page
<Pagination
    currentPage=1
    totalPages=20
    onPageChange={(pageNo: number) => console.log(pageNo)}
/>

Detail Usage

import React, { useState } from "React";
import Pagination from 'react-awesome-paginate';

// For CSS Styling, you have to import this below file (You can override, if you want.)

import 'react-awesome-paginate/dist/index.css';

const ExampleComponent = () => {
    const [currentPage, setCurrentPage] = useState(1);
    const [totalPages, setTotalPages] = useState(1);


    const handlePageChange = (pageNo) => {
        if(pageNo === currentPage)
            return;

        // API Call && Set current page 
    }

    return (
        <Pagination
            currentPage={currentPage}
            totalPages={totalPages}
            onPageChange={(pageNo: number) => handlePageChange(pageNo)}
        />
    )
}

export default ExampleComponent;

Events

NameTypeStatusDescription
onPageChangeFunctionRequiredonPageChange is a Function. When event is triggerd, it gives triggered page no. as an argument.

Props

NameTypeStatusDescription
currentPageNumberRequiredcurrentPage number. Default value 1
totalPagesNumberRequiredtotalPages number. Default value 1
previousLabelStringOptionalpreviousLabel for previous button. Default value Previous
nextLabelStringOptionalnextLabel for next button. Default value Next
morePagesLabelStringOptionalmorePagesLabel for break level. Default value ...
paginationThemeStringOptionalpaginationTheme for next button. Default value default. There are four types of theme, you can use, these are defaultcircularclassiccompact
activeClassNameStringOptionalactiveClassName for active button. Default value active. You can add your own custom class & give custom style in your component
containerClassNameStringOptionalcontainerClassName for active button. Default value None. You can add your own custom container class & give custom style in your component
prevClassNameStringOptionalprevClassName for active button. Default value None. You can add your own custom class & give custom style to previous button in your component
nextClassNameStringOptionalnextClassName for active button. Default value None. You can add your own custom class & give custom style to next button in your component

If you like this package please give me a star(*) in my Github Repo

If you find any issue please please report here Github Issues

Awesome React Pagination npm | Easy installation | You can do everything custom

Simple react pagination package. #react-pagination #react-awesome-paginate
#react-awesome-pagination #pagination react

Comments

Popular posts from this blog

What is deep web? Comparison between Deep Web, Surface Web and Dark Web. How do you access it?

  Deep Web:  The   Deep web is a part of the World Wide Web whose contents are not publically accessible like Bank Accounts, Email Storage, Private Database, Facebook Message anything that traditional search engine like Google, Bing, Yahoo etc. cannot access. The term “Deep Web” comes from  Michael K. Bergman  a computer scientist in 2001. It is a large portion of the internet estimated at 95%. Surface Web:  The   Surface Web  (also called the Visible   Web, Indexed Web) is a small part of the World Wide   Web  that is readily available to the general public and searchable with standard   web  search engines like Google, Bing, Yahoo etc. It is the opposite of the deep   web. It is a small portion of the internet estimated at 5%. Pic: Surface, Deep and Dark Web (From Google) Dark Web:  The   Dark web is the small part of the Deep Web where websites are purposely hidden like Drug Markets,  Whistleblower s...

What is the difference between React JS and React Native? Properties of React JS and React Native.

  ReactJS  is a JavaScript library, supporting both front end web and being run on the server, for building user interfaces and web applications. React Native  is a mobile framework that compiles to native app components, allowing you to build native mobile applications (iOS, Android, and Windows) in JavaScript that allows you to use ReactJS to build your components, and implements ReactJS under the hood.

Must-Know Security Practices for Every Full Stack Developer should know in 2025

  Must-Know Security Practices for Every Full Stack Developer should know in 2025 In today's world of rapid development, ignoring security can cost more than just downtime. Whether you're building SaaS, eCommerce, or APIs — security must be baked into every layer . Here’s a power-packed checklist every Full Stack Developer should follow: Frontend Security 1. XSS Attack (Cross-Site Scripting) Never trust user input. Sanitize all dynamic content. ❌ dangerouslySetInnerHTML (React) ✅ Use v-text or auto-binding (Vue, Angular) 2. CSRF Attack (Cross-Site Request Forgery) Session cookies can betray you. ✅ Use SameSite=Strict cookies + CSRF tokens. 3. Secure Local Storage Don’t store access tokens in localStorage . ✅ Use HttpOnly cookies instead. 4. CSP Headers Prevent malicious scripts. ✅ Add Content-Security-Policy: script-src 'self' Backend Security 1. CORS Policy (Cross-Origin Resource Sharing) Only allow known origins. ✅ Acc...