Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
rc-pagination
Advanced tools
The rc-pagination package is a React component for creating paginated interfaces, allowing users to navigate through pages of items. It provides a range of customization options to tailor the pagination behavior and appearance to the needs of different applications.
Basic Pagination
This code sample demonstrates how to render a basic pagination component with a total of 50 items.
import Pagination from 'rc-pagination';
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<Pagination total={50} />,
document.getElementById('container')
);
Custom Page Size
This code sample shows how to set a custom page size and enable a size changer dropdown for the user to select how many items to display per page.
import Pagination from 'rc-pagination';
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<Pagination total={500} defaultPageSize={20} showSizeChanger />,
document.getElementById('container')
);
Controlled Component
This code sample illustrates how to create a controlled pagination component where the current page state is managed by the parent component.
import Pagination from 'rc-pagination';
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
const App = () => {
const [current, setCurrent] = useState(1);
const onChange = page => {
setCurrent(page);
};
return (
<Pagination current={current} onChange={onChange} total={100} />
);
};
ReactDOM.render(<App />, document.getElementById('container'));
Jump to Page
This code sample demonstrates how to enable the 'quick jumper' feature, allowing users to jump to a specific page directly.
import Pagination from 'rc-pagination';
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<Pagination total={100} showQuickJumper />,
document.getElementById('container')
);
react-paginate is a React component to create pagination. It provides built-in styles and is highly customizable. Compared to rc-pagination, react-paginate might be more suitable for those who prefer a component with out-of-the-box styled elements.
react-js-pagination is another React component for pagination. It is similar to rc-pagination but offers different customization options and styles. It might be a good alternative for users looking for a slightly different look and feel.
material-ui is a set of React components that implement Google's Material Design, including a pagination component. It is a comprehensive UI framework that offers a Material Design styled pagination component, which is different from the minimalistic approach of rc-pagination.
React Pagination Component.
npm install
npm start
http://localhost:3000/examples/
online example: http://react-component.github.io/pagination/examples/
var Pagination = require('rc-pagination');
var React = require('react');
React.render(<Pagination />, container);
Parameter | Description | Type | Default |
---|---|---|---|
defaultCurrent | uncontrolled current page | Number | 1 |
current | current page | Number | undefined |
total | items total count | Number | 0 |
defaultPageSize | default items per page | Number | 10 |
pageSize | items per page | Number | 10 |
onChange | page change callback | Function(current, pageSize) | - |
showSizeChanger | show pageSize changer | Bool | false |
pageSizeOptions | specify the sizeChanger selections | Array | ['10', '20', '30', '40'] |
onShowSizeChange | pageSize change callback | Function(current page, size) | - |
showQuickJumper | show quick goto jumper | Bool | false |
showTotal | show total records and range | Function(total, [from, to]) | - |
className | className of pagination | String | - |
simple | when set, show simple pager | Object | null |
locale | to set l10n config | Object | zh_CN |
style | the style of pagination | Object | {} |
showLessItems | show less page items | Bool | false |
rc-pagination is released under the MIT license.
FAQs
pagination ui component for react
The npm package rc-pagination receives a total of 1,185,845 weekly downloads. As such, rc-pagination popularity was classified as popular.
We found that rc-pagination demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.