react-pagination-toolkit
v1.0.0
Published
A react component to control pagination with page size handling.
Maintainers
Readme
React-Pagination-Toolkit
React Pagination Toolkit is a modern highly customizable component built to give developers full control over pagination in one component, without the need to have 2 components for pagination and page size selection.
Features include:
- Flexible pagination component
- The ability to include page size selection
- Fully customizable labels
Installation and usage
The easiest way to use react-pagination-toolkit is to install it from npm.
# yarn
yarn add react-pagination-toolkit
# npm
npm install react-pagination-toolkit
# pnpm
pnpm add react-pagination-toolkitThen use it in your app:
import React, { useState } from 'react';
import { Pagination } from 'react-pagination-toolkit';
export default function App() {
const [currentPage, setCurrentPage] = useState<number>(1);
const totalItems = 150;
const handlePageChange = (page: number) => {
setCurrentPage(page);
};
return (
<div>
<Pagination
currentPage={currentPage}
totalItems={totalItems}
pageSize={pageSize}
onPageChange={handlePageChange}
onPageSizeChange={handlePageSizeChange}
labels={first: "first", last:"last", pageSizeLabel: "Page size"}
/>
</div>
);
}Props
Common props you may want to specify include:
totalItems- the total number of items, based on which the total nummber of pages is calculatedpageSize- the number of items to be displayed on each pageonPageChange- subscribe to page change eventscurrentPage- the currently selected pageclassName- apply a className to the controldisabled- disable the controlshowFirstLastButtons- shows the navigate to first and last pages buttonsshowPrevNextButtons- shows the navigate to previous and next pages buttonsmaxPageButtons- the maximum number of pages to be shown in the controlshowPageSizeSelectorLabel- shows/hides the label next to page size selection dropdownshowTotalItems- shows/hides the total number of itemsshowPageNumbers- shows/hides the page numbersshowPageSizeOptions- shows/hides the page size selectiononPageSizeChange- subscribe to page size change eventspageSizeOptions- accepted page sizes for page size selectionlabels- custom labels for page size, items, first and last pages, previous and next pages
TypeScript
This component is developed using typescript and supports typescript out of the box, no need to install additional typings.
To Do / Future Enhancements
Planned Features
- Add more control over css classes
- Custom button renderers - Slot-based customization
- Unit testing
- Storybook documentation - Interactive component playground
License
MIT Licensed. Copyright (c) Bechara Murr 2026.
