Getting Started

Installation

Install react-responsive-pagination from npm:

Terminal window
npm install react-responsive-pagination

Compatibility

Minimal example

The component ships no styles of its own, so the example imports one of the included themes (see also the Tailwind, Bootstrap and Custom CSS guides):

import { useState } from 'react';
import ResponsivePagination from 'react-responsive-pagination';
import 'react-responsive-pagination/themes/classic-light-dark.css';
export default function Pager({ totalPages }) {
const [currentPage, setCurrentPage] = useState(1);
return (
<ResponsivePagination
current={currentPage}
total={totalPages}
onPageChange={setCurrentPage}
/>
);
}

Integration notes

<ResponsivePagination
current={page}
total={totalPages}
onPageChange={goToPage}
linkHref={page => `?page=${page}`}
/>

See the Props Reference for everything else.

Getting Started