Pagination

Pagination helps users navigate through large datasets by splitting content into discrete pages. It provides intuitive controls for moving between pages and jumping to specific pages.

Basic Usage

import { Pagination } from '@/components'

const [page, setPage] = useState(5)

<Pagination page={page} totalPages={30} onPageChange={setPage} />

Variants

Square (Default)

Page buttons with square corners and subtle borders.

<Pagination page={page} totalPages={30} onPageChange={setPage} variant="square" />

Circle

Page buttons with fully rounded corners.

<Pagination page={page} totalPages={30} onPageChange={setPage} variant="circle" />

Transparent

Minimal page buttons without backgrounds, active page indicated by blue text and dot.

<Pagination page={page} totalPages={30} onPageChange={setPage} variant="transparent" />

Number

Simplified layout with only navigation arrows and page indicator text.

<Pagination page={page} totalPages={30} onPageChange={setPage} variant="number" />

Configuration Options

Hide Page Selector

Remove the "Go to page" dropdown.

<Pagination page={page} totalPages={30} onPageChange={setPage} showPageSelector={false} />

Hide Page Indicator

Remove the "Page X of Y" text.

<Pagination page={page} totalPages={30} onPageChange={setPage} showIndicator={false} />

Minimal

Hide both the page indicator and page selector for a compact pagination.

<Pagination
  page={page}
  totalPages={30}
  onPageChange={setPage}
  showIndicator={false}
  showPageSelector={false}
/>

Few Pages

When total pages fit within the display, all pages are shown without ellipsis.

<Pagination page={page} totalPages={5} onPageChange={setPage} />

Sibling Count

Control how many page numbers appear on each side of the current page.

siblingCount=1 (default)

siblingCount=2

<Pagination page={page} totalPages={30} onPageChange={setPage} siblingCount={2} />

Controlled

The pagination component is fully controlled. Manage the current page state externally.

Current page: 1

const [page, setPage] = useState(1)

<Pagination page={page} totalPages={30} onPageChange={setPage} />

All Variants

Square (default)

Circle

Transparent

Number

Accessibility

  • Uses semantic <nav> element with aria-label="Pagination"
  • Page buttons have aria-label for screen readers
  • Active page is marked with aria-current="page"
  • Navigation buttons are disabled and marked as such when at boundaries
  • Keyboard navigation is fully supported through the page selector

API Reference

Pagination Props

PropTypeDefaultDescription
pagenumber-Current page (1-indexed, required)
totalPagesnumber-Total number of pages (required)
onPageChange(page: number) => void-Callback when page changes
variant'square' | 'circle' | 'transparent' | 'number''square'Visual style variant
showIndicatorbooleantrueShow "Page X of Y" text
showPageSelectorbooleantrueShow "Go to page" dropdown
siblingCountnumber1Pages shown on each side of current page
classNamestring-Additional CSS classes