Skip to content
GitHub (opens in a new tab)

Pagination

Page navigation with previous, next, page numbers and ellipsis.

stableMoleculecontracts/pagination.json

Preview

Pagination

Previous, page numbers, ellipsis, Next. Optional first and last, rows per page and a status for table footers. Kit Buttons and Select. Not ButtonGroup.

Master

Controlled page 2 of 10, medium size. Click pages or Previous/Next to change page.

Usage

Page tables, long lists, and search results. Sits below a Table or DataTable. Not ButtonGroup. Not Tabs. Do not invent cousins.

Do's

  • tables
  • table footer with page size and results
  • long lists
  • search results

Don'ts

  • in-page panels — Tabs
  • a pair of sibling actions — ButtonGroup
  • infinite scroll or Load more — a kit Button below the list
<Pagination
  page={2}
  pageCount={10}
  onPageChange={() => {}}
/>

Page navigation with previous, next, page numbers, and ellipsis, plus optional first/last, a rows-per-page Select and a page or results status for table footers. Not ButtonGroup. Not Tabs.

When to use

  • tables
  • table footer with page size and results
  • long lists
  • search results

When not to use

  • in-page panels — Tabs
  • a pair of sibling actions — ButtonGroup
  • infinite scroll or Load more — a kit Button below the list

What an agent reads

import { Pagination } from "agentic-ds-kit";
must
  • nav with aria-label from the pagination kit label ("Pagination"), or the aria-label prop
  • Previous and First page disabled on page 1
  • Next and Last page disabled on the last page
  • current page uses kit Button appearance=outline mode=neutral, with aria-current=page on that button
  • ellipsis is a span with Lucide Ellipsis, aria-hidden, not a Button
  • icon-only Previous/Next/First/Last set ariaLabel
  • compact: the status shows "2 of 10" (pageOf, aria-hidden) and reads "Page 2 of 10" (pageStatus, visually hidden) in an aria-live=polite span
  • page-size picker is kit Select named "Rows per page" (rowsPerPage), with the same words visible beside it
  • status is one role=status aria-live=polite aria-atomic span. page shows pageStatus. range shows resultRange (aria-hidden) and reads resultRangeStatus (visually hidden), e.g. "Showing 26 to 50 of 240 results"
  • collapse=narrow hides the unused layout with display:none, so only one live region is ever announced
  • built-in labels (pagination, previous, next, previousPage, nextPage, firstPage, lastPage, pageOf, pageStatus, rowsPerPage, resultRange, resultRangeStatus) come from KitLabelsProvider; English by default
defaults
  • compact false
  • defaultPage 1
  • showPages true
  • showLabels true
  • showPreviousNext true
  • size md
  • showFirstLast false
  • status none
  • collapse never
stops if
  • no PaginationContent/Item/Link/Previous/Next/Ellipsis cousins
  • do not use raw hex
  • do not use ButtonGroup for paging
  • page numbers are kit Button
  • no native select or local cousin for page size — use pageSizeOptions (kit Select)
  • do not repeat the results range in the Table caption or a second status line

From contracts/pagination.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
compactbooleanNofalseNarrow layout for small screens: icon-only Previous and Next ("Previous page", "Next page") around a "2 of 10" status. Ignores showPages, showLabels, showFirstLast, status and the page-size picker. The default layout wraps instead of overflowing. For an automatic switch use collapse="narrow".
pagenumberNo—controlled 1-based. Controlled when page is a number.
defaultPagenumberNo1uncontrolled initial page
pageCountnumberYes—>= 1
onPageChangefunctionNo—(page: number) => void
showPagesbooleanNotruefalse shows Previous/Next only (icons-only when showLabels is also false)
showLabelsbooleanNotruePrevious / Next text next to chevrons. Icon-only uses ariaLabel.
showPreviousNextbooleanNotruefalse hides Previous/Next (Simple: page numbers only)
sizesm | mdNomdpassed to kit Button
showFirstLastbooleanNofalseIcon-only ghost Buttons (ChevronsLeft, ChevronsRight) outside Previous and Next, named "First page" and "Last page". Disabled on the first and last page.
pageSizeOptionsarrayNo—Shows "Rows per page" and a kit Select of these sizes, e.g. [10, 25, 50], at the start of the row. Omit for no picker.
pageSizenumberNo—The current page size. Controlled: the parent recomputes pageCount. Also used by status="range".
onPageSizeChangefunctionNo—(pageSize: number) => void. After it, Pagination calls onPageChange(1) (and resets an uncontrolled page to 1), because a new size reflows every page.
statusnone | page | rangeNononeText at the start of the row. page: "Page 2 of 10". range: "26–50 of 240", needs totalCount and pageSize, and falls back to page without them.
totalCountnumberNo—Total number of rows, for status="range". 0 shows "0 of 0".
collapsenever | narrowNonevernarrow: under 480px of container width (the same as Table stack) the nav shows the compact layout. The nav becomes an inline-size container, so give it a width (block flow, not a shrink-to-fit parent). compact wins when both are set.
  • Component
    →

    Tabs

    Switch between related views in place.

  • Component
    →

    ButtonGroup

    Joined row of kit Buttons that share one size and act as one control cluster.

  • Component
    →

    Button

    Clickable action control with appearance × mode (plus an optional flat set) and a fixed set of sizes.

  • Component
    →

    Select

    Choose one or several options from a list.