Pagination

Navigation controls for moving through paged data or content.

Overview

Pagination provides composable pagination primitives plus PaginationRoot, a managed pagination renderer with controlled and URL-state modes.

Generated PaginationRoot controls render as real buttons. If you provide href to an individual PaginationLink, that link renders as an anchor while keeping Cubitt button styling.

Usage

import {
  Pagination,
  PaginationContent,
  PaginationEllipsis,
  PaginationItem,
  PaginationLink,
  PaginationNext,
  PaginationPrevious,
  PaginationRoot,
} from "@tilt-legal/cubitt-components/pagination";
<PaginationRoot
  currentPage={2}
  onPageChange={(page) => setPage(page)}
  totalPages={20}
/>
<Pagination>
  <PaginationContent>
    <PaginationItem>
      <PaginationPrevious href="/page/1" />
    </PaginationItem>
    <PaginationItem>
      <PaginationLink href="/page/2" isActive>
        2
      </PaginationLink>
    </PaginationItem>
    <PaginationItem>
      <PaginationNext href="/page/3" />
    </PaginationItem>
  </PaginationContent>
</Pagination>

Examples

Basic

URL State

API Reference

PaginationRoot

PropTypeDefaultDescription
currentPagenumberURL value or 1Controlled active page.
totalPagesnumberTotal number of pages.
onPageChange(page: number) => voidCalled when a generated page control is clicked.
showPrevNextbooleantrueShow previous and next controls.
showFirstLastbooleantrueShow first and last page controls when they are outside the visible range.
maxVisiblePagesnumber5Maximum number of page number controls in the main range.
paramNamestringURL search parameter name for URL-state mode.
paramValuenumberExternal URL-state value override.
onUrlValueChange(page: number | null) => voidCalled when URL state changes.
paramClearOnDefaultbooleanRemove the URL param when page equals the default value.
paramDebouncenumberDebounce URL updates in milliseconds.
paramThrottlenumberThrottle URL updates in milliseconds.
classNamestringAdditional classes for the pagination root.

Pagination

PropTypeDefaultDescription
classNamestringAdditional classes for the nav.

PaginationContent

PropTypeDefaultDescription
classNamestringAdditional classes for the list.

Uses Button styling internally. Active links use the secondary button variant; inactive links use ghost.

PropTypeDefaultDescription
isActivebooleanfalseMarks the link as the current page.
hrefstringWhen provided, renders as an anchor.
size"sm" | "md" | "lg""md"Button size.
mode"icon" | "input""icon"Button mode.
disabledbooleanfalseDisable the control when rendered as a button.
classNamestringAdditional classes for the control.

PaginationPrevious / PaginationNext

Convenience wrappers around PaginationLink with directional icons and accessible labels.

PropTypeDefaultDescription
hrefstringWhen provided, renders as an anchor.
disabledbooleanfalseDisable the generated button control.
classNamestringAdditional classes for the control.

PaginationEllipsis

PropTypeDefaultDescription
classNamestringAdditional classes for the ellipsis item.

On this page