Skip to main content

Pagination

Import

import { Pagination } from "@sparrowengg/twigs-react";

Usage

Result
Loading...
function App() {
  const [activePage, setActivePage] = useState(1);
  return (
    <Pagination
      activePage={activePage}
      itemsPerPage={10}
      total={100}
      onChange={(event, page) => setActivePage(page)}
    />
  );
}

siblingCount

siblingCount is the number of buttons to show on left and right of the active page button. By default siblingCount count is 1.

<Pagination
activePage={activePage}
itemsPerPage={10}
total={100}
siblingCount={2}
onChange={(event, page) => setActivePage(page)}
/>

Props

PropertyDescriptionTypeDefault
activePageCurrent highlighted pagenumber
itemsPerPageItems in each pagenumber
totaltotal items
siblingCountnumber of buttons to show on left and right of the active page buttonnumber1
onChangefunction
sizesize of buttons in paginationxxs xs sm md lg xl 2xl