1.0.2 • Published 6 years ago

react-paginate-x v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

react-paginate-x

A bare-bones React component for pagination UI that doesn't require CSS.

Install

With npm:

npm install --save react-paginate-x

Or with Yarn:

yarn add react-paginate-x

Usage

import Pagination from 'react-paginate-x'

...

<Pagination currentPage={1} totalPages={50} />

To use with the default or a custom link element:

<Pagination
	link={(n, text) => (
		<a href={`/page/${n}`}>{text}</a>
	)}
	currentPage={1}
	totalPages={50} />

Or to use with an onClick handler:

<Pagination
	onClick={n => console.log('Go to page', n)}
	currentPage={1}
	totalPages={50} />

Options

PropertyDescriptionTypeDefault
currentPageThe current pageNumber1
totalPagesTotal number of pagesNumberundefined
linkA function that creates the element for linksFunctionundefined
previousContents of the previous linkString or Boolean"previous"
nextContents of the next linkString or Boolean"next"
firstContents of the first linkString or Booleanfalse
lastContents of the last linkString or Booleanfalse
breakDelimiterContents of the page breaksString or Component"..."
boundaryPagesRangeNumber of pages on the edgesNumber2
siblingPagesRangeNumber of pages next to active pageNumber2
hideInactiveHides the first, last, previous, or next links when activeBooleantrue