Skip to content

A simple pagination component for React based on WordPress algorithms.

License

Notifications You must be signed in to change notification settings

igmoweb/react-wp-pagination

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React WP Pagination Component

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

Instructions

  1. npm install
  2. npm run storybook. Open your browser and you'll see a few examples.
  3. npm run build to bundle the production files under build folder.

Props

  • 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 ul container
  • onClickPage: Callback executed when a page is clicked. The callback will receive the page clicked number.

About

A simple pagination component for React based on WordPress algorithms.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published