UNPKG

11.2 kBMarkdownView Raw
1# rc-pagination
2
3React Pagination Component.
4
5[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][coveralls-image]][coveralls-url] [![codecov](https://codecov.io/gh/react-component/pagination/branch/master/graph/badge.svg)](https://codecov.io/gh/react-component/pagination) [![Dependencies](https://img.shields.io/david/react-component/pagination.svg?style=flat-square)](https://david-dm.org/react-component/pagination) [![DevDependencies](https://img.shields.io/david/dev/react-component/pagination.svg?style=flat-square)](https://david-dm.org/react-component/pagination?type=dev) [![npm download][download-image]][download-url]
6
7[npm-image]: http://img.shields.io/npm/v/rc-pagination.svg?style=flat-square
8[npm-url]: http://npmjs.org/package/rc-pagination
9[github-actions-image]: https://github.com/react-component/pagination/workflows/CI/badge.svg
10[github-actions-url]: https://github.com/react-component/pagination/actions
11[coveralls-image]: https://img.shields.io/coveralls/react-component/pagination.svg?style=flat-square
12[coveralls-url]: https://coveralls.io/r/react-component/pagination?branch=master
13[download-image]: https://img.shields.io/npm/dm/rc-pagination.svg?style=flat-square
14[download-url]: https://npmjs.org/package/rc-pagination
15
16## Development
17
18```
19npm install
20npm start
21```
22
23## Example
24
25http://localhost:9001
26
27online example: https://pagination-react-component.vercel.app
28
29## Install
30
31[![rc-pagination](https://nodei.co/npm/rc-pagination.png)](https://npmjs.org/package/rc-pagination)
32
33## Usage
34
35```js
36import Pagination from 'rc-pagination';
37
38ReactDOM.render(<Pagination />, container);
39```
40
41## API
42
43| Parameter | Description | Type | Default |
44| ---------------------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
45| disabled | disable pagination | Bool | - |
46| defaultCurrent | uncontrolled current page | Number | 1 |
47| current | current page | Number | undefined |
48| total | items total count | Number | 0 |
49| defaultPageSize | default items per page | Number | 10 |
50| pageSize | items per page | Number | 10 |
51| onChange | page change callback | Function(current, pageSize) | - |
52| showSizeChanger | show pageSize changer | Bool | `false` when total less then `totalBoundaryShowSizeChanger`, `true` when otherwise |
53| totalBoundaryShowSizeChanger | when total larger than it, `showSizeChanger` will be true | number | 50 |
54| pageSizeOptions | specify the sizeChanger selections | Array<String> | ['10', '20', '50', '100'] |
55| onShowSizeChange | pageSize change callback | Function(current, size) | - |
56| hideOnSinglePage | hide on single page | Bool | false |
57| showPrevNextJumpers | show jump-prev, jump-next | Bool | true |
58| showQuickJumper | show quick goto jumper | Bool / Object | false / {goButton: true} |
59| showTotal | show total records and range | Function(total, [from, to]) | - |
60| className | className of pagination | String | - |
61| simple | when set, show simple pager | Object | null |
62| locale | to set l10n config | Object | [zh_CN](https://github.com/react-component/pagination/blob/master/src/locale/zh_CN.js) |
63| style | the style of pagination | Object | {} |
64| showLessItems | show less page items | Bool | false |
65| showTitle | show page items title | Bool | true |
66| itemRender | custom page item renderer | Function(current, type: 'page' \| 'prev' \| 'next' \| 'jump-prev' \| 'jump-next', element): React.ReactNode \| `(current, type, element) => element` | |
67| prevIcon | specifict the default previous icon | ReactNode \| (props: PaginationProps) => ReactNode | |
68| nextIcon | specifict the default previous icon | ReactNode \| (props: PaginationProps) => ReactNode | |
69| jumpPrevIcon | specifict the default previous icon | ReactNode \| (props: PaginationProps) => ReactNode | |
70| jumpNextIcon | specifict the default previous icon | ReactNode \| (props: PaginationProps) => ReactNode | |
71
72## License
73
74rc-pagination is released under the MIT license.