2.0.1 • Published 7 months ago
@alwaan/react-pagination v2.0.1
# @alwaan/react-pagination
A flexible and customizable pagination component for React applications.
## Installation
You can install this package via npm:
```bash
npm install @alwaan/react-pagination
Usage
To use the Pagination component in your React application, follow these steps:
Import the component into your application:
import React from 'react'; import Pagination from '@alwaan/react-pagination';
Include the Pagination component in your component's JSX code. You can customize the component by passing the necessary props.
const App = () => { // Your component logic here return ( <div> {/* Your content goes here */} <Pagination page={currentPage} // The current page number limit={itemsPerPage} // Items per page total={totalItems} // Total number of items displayPageRange={pagesToDisplayEachSide} // Page numbers displayed on each side (Default 2) onPageChange={handlePageChange} // Function to handle page changes /> </div> ); }; export default App;
Customize the
Pagination
component by passing the required props:page
: The current page number.limit
: The number of items to display per page.total
: The total number of items.displayPageRange
: Number of page numbers to display on each side of the current page. (Default 2)onPageChange
: A callback function to handle page changes.
Props
page
(Number)
The current page number.
limit
(Number)
The number of items to display per page.
total
(Number)
The total number of items.
displayPageRange
(Number)
Number of page numbers to display on each side of the current page. (Default 2).
onPageChange
(Function)
A callback function to handle page changes. It receives the new page number as an argument.
Issues
If you encounter any issues or have suggestions for improvements, please email us at support@alwaantechnology.com.