Components

Pagination

A navigation control for traversing paginated content.

Installation

npm install @mijn-ui/react-pagination

Usage

import {
  Pagination,
  PaginationContent,
  PaginationList,
  PaginationNextButton,
  PaginationNextEllipsis,
  PaginationPreviousButton,
  PaginationPreviousEllipsis,
} from @mijn-ui/react-pagination
const [currentPage, setCurrentPage] = React.useState(7)
const ItemsPerPage = 10
const TotalPage = 160

<Pagination
  totalPages={TotalPage}
  currentPage={currentPage}
  itemsPerPage={ItemsPerPage}
  onChangePage={setCurrentPage}
>
  <PaginationContent>
    <PaginationPreviousButton>Previous</PaginationPreviousButton>
    <PaginationPreviousEllipsis />
    <PaginationList />
    <PaginationNextEllipsis />
    <PaginationNextButton>Next</PaginationNextButton>
  </PaginationContent>
</Pagination>

API Reference

Standard element attributes are forwarded to the underlying component in addition to the props below.

PropTypeDefaultDescription
unstyledbooleanfalseOpt out of the default styles to fully customize the component.
classNamesobjectOverride classes per slot (see Style Slots below).
classNamestringAdditional classes for the root element.

Pagination Style Slots

Slot NameTargeted ComponentPurpose
basePaginationStyles the root pagination component.
contentPaginationContentStyles the content area of the pagination.
listPaginationListStyles the list container for pagination items.
listItemPaginationListStyles individual pagination items.
previousBtnPaginationPreviousButtonStyles the button for the previous page.
previousElipsisPaginationPreviousElipsisStyles the ellipsis before the previous page.
nextBtnPaginationNextButtonStyles the button for the next page.
nextElipsisPaginationNextElipsisStyles the ellipsis after the next page.