Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
nextjs-pagination
Advanced tools
Nextjs-Pagination is a powerful, customizable, and user-friendly pagination component developed specifically for Next.js projects. Engineered with a keen focus on enhancing user experience, it provides comprehensive configuration flexibility allowing you to fine-tune the pagination functionality and aesthetics according to your unique requirements. The component is developed in TypeScript, thereby providing the benefits of type safety and autocompletion support in editors that support these features.
Install the package using npm by executing the following command in your terminal:
npm install nextjs-pagination
Firstly, you need to import the Pagination component from the nextjs-pagination
package. The import statement varies based on whether you are using JavaScript or TypeScript:
JavaScript:
import Pagination from 'nextjs-pagination';
TypeScript:
import { Pagination } from 'nextjs-pagination';
Once the Pagination component is imported, you can use it in your components like this:
<Pagination totalItems={100} itemsPerPage={10} />
The above code snippet will render a pagination component for 100 items with 10 items per page.
Here is a detailed list of props that you can pass to the Pagination component for configuration:
Prop | Description | Type | Default | Required |
---|---|---|---|---|
totalItems | The total number of items that need to be paginated. | number | - | Yes |
itemsPerPage | The number of items to be displayed per page. | number | - | Yes |
color | The color of the buttons. | string | '#007bff' | No |
shape | The shape of the buttons. The options are 'circle' or 'square'. | string | 'square' | No |
buttonCount | The maximum number of page buttons that can be displayed at a time. | number | 5 | No |
showNextPrev | Flag to control the visibility of 'Next' and 'Prev' buttons. | boolean | false | No |
showFirstLast | Flag to control the visibility of 'First' and 'Last' buttons. | boolean | false | No |
onSuccess | Callback function which will be called when a page change occurs successfully. | function | () => {} | No |
onError | Callback function which will be called when a page change error occurs. | function | () => {} | No |
Here is an example of how to use the Pagination component with a customized set of props:
<Pagination
totalItems={500}
itemsPerPage={20}
color="green"
shape="circle"
buttonCount={7}
showNextPrev={true}
showFirstLast={true}
onSuccess={(page) => console.log("Current page: ", page)}
onError={(error) => console.error("Page change error: ", error)}
/>
We welcome contributions! Whether it's a bug report, feature request or a code contribution, we greatly appreciate all help to improve Nextjs-Pagination. For major changes, please open an issue first to discuss what you would like to change.
Nextjs-Pagination is MIT licensed.
FAQs
A highly customizable pagination component for Next.js applications. It provides flexible configuration options for page navigation and improves user experience in large scale data environments.
The npm package nextjs-pagination receives a total of 11 weekly downloads. As such, nextjs-pagination popularity was classified as not popular.
We found that nextjs-pagination demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.