1.1.6 • Published 11 months ago

@wpmudev/react-pagination v1.1.6

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
11 months ago

License: GPLv3 npm npm peer dependency version

React Pagination

React Pagination allows you include to paginate your long-list items on your project.

npm i @wpmudev/react-pagination --save-dev

Usage

Javascript Instantiation

import React from "react";

import { Pagination } from "@wpmudev/react-pagination";

const MyApp = () => {

	//This is a prop that has to be passed to Pagination if we want a custom pagination.
	const paginationContent = ({ ...properties }) => { 
	/*You might wonder why *properties* instead of props. It is to make sure that the props which you might already be using in your component or file does not effect the ones that we want to use for the pagination.
	For that reason, it is highly recommended to use properties and append any other props that you might want to use inside the paginationContent.
	properties have all the required values for pagination.*/
		return (
			<>
				{PaginationNav({ ...properties })}
				{PaginationResults({ ...properties })}
				<div>Belllaaaa</div>
			</>
		);
	};

	return (
		<Pagination
			limit={5}
			results={true}
			skip={true}
			pagesToBottom={false} //This does not make any difference when using *paginationContent*.
			skipToFirstLabel=""
			previousLabel=""
			nextLabel=""
			skipToLastLabel=""
			child={childrenArray}
			paginationContent
		>
			<div>Element 1 could be here</div>
			<div>Element 2 could be here</div>
			<div>Element 3 could be here</div>
		</Pagination>
	);
};

Props

Prop NameTypeDescription
limitIntegerEnter the elements limit per page.
resultsBooleanShows results section if true.
skipBooleanShows skip arrow buttons if true.
pagesToBottomBooleanPages will be rendered at bottom if true
skipToFirstLabelStringString to be passed which will act as a label for skip to first button
previousLabelStringString to be passed which will act as a label for next page button
nextLabelStringString to be passed which will act as a label for previous page button
skipToLastLabelStringString to be passed which will act as a label for skip to last button
childArrayPass an array here to render as elements.
paginationContentcomponentPass a component here to be rendered custom.
1.1.6

11 months ago

1.1.5

11 months ago

1.1.1

2 years ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

2 years ago

1.1.0

3 years ago

1.0.0

3 years ago