woocommerce/packages/js/components/src/pagination
Chi-Hsuan Huang 7068c78101
Fix JS lint errors (#33484)
* Fix @woocommerce/data lint errors

* Fix internal-e2e-builds lint error

* Fix lint errors
2022-06-21 16:37:34 +08:00
..
stories Moved WCA Packages 2022-03-18 14:25:26 -07:00
README.md Moved WCA Packages 2022-03-18 14:25:26 -07:00
index.js Fix JS lint errors (#33484) 2022-06-21 16:37:34 +08:00
style.scss Moved WCA Packages 2022-03-18 14:25:26 -07:00

README.md

Pagination

Use Pagination to allow navigation between pages that represent a collection of items. The component allows for selecting a new page and items per page options.

Usage

<Pagination
	page={ 1 }
	perPage={ 10 }
	total={ 500 }
	onPageChange={ ( newPage ) => setState( { page: newPage } ) }
	onPerPageChange={ ( newPerPage ) => setState( { perPage: newPerPage } ) }
/>

Props

Name Type Default Description
page Number null (required) The current page of the collection
onPageChange Function noop A function to execute when the page is changed
perPage Number null (required) The amount of results that are being displayed per page
onPerPageChange Function noop A function to execute when the per page option is changed
total Number null (required) The total number of results
className String null Additional classNames
showPagePicker Boolean true Whether the page picker should be shown.
showPerPagePicker Boolean true Whether the per page picker should shown.
showPageArrowsLabel Boolean true Whether the page arrows label should be shown.