A simple pagination component for React based on WordPress algorithms.
Thanks to WordPress for the pagination algorithm: https://codex.wordpress.org/Function_Reference/paginate_links
This project was bootstrapped with Create React App.
Samples provided thanks to Storybook
npm installnpm run storybook. Open your browser and you'll see a few examples.npm run buildto bundle the production files underbuildfolder.
- total: Total pages
- current: Current page
- showAll: Show all pages
- prevText: Text for the previous link button. If nothing is provided, the link will not appear.
- nextText: Text for the next link button. If nothing is provided, the link will not appear.
- endSize: Number of max links on the extremes of the pages list.
- midSize: Number of max links around the current page, left and right.
- baseClassName: Class name of the
ulcontainer - onClickPage: Callback executed when a page is clicked. The callback will receive the page clicked number.