0.1.8 • Published 6 months ago
react-pagination-ts v0.1.8
React Pagination TS
Installation
Install react-pagination-ts
with npm:
npm install react-pagination-ts --save
Usage
import { useEffect, useState } from "react";
import { Pagination } from "react-pagination-ts";
function App() {
const [page, setPage] = useState(1);
const handlePageClick = (_, newPage: number) => {
setPage(newPage);
};
return (
<>
<Pagination
currentPage={page}
defaultPage={1}
onPageChange={handlePageClick}
pageCount={30}
/>
</>
);
}
export default App;
Props
Name | Type | default | Description |
---|---|---|---|
totalPage | Number | 1 | Required. The total number of pages. |
defaultPage | Number | 1 | The page selected by default when the component is uncontrolled. |
currentPage | Number | 1 | The current page. |
siblingCount | Number | 1 | Number of always visible pages before and after the current page. |
boundaryCount | Number | 1 | Number of always visible pages at the beginning and end. |
disabled | Boolean | false | If true , the component is disabled. |
hideNextButton | Boolean | false | If true , hide the next-page button. |
hidePrevButton | Boolean | false | If true , previous-page button. |