Pagination

A React component in Beamline's Navigation category, in the free sample.

Moves through pages of a known length: first, last and the current page's neighbours, with an optional “41–60 of 468”. It answers to its own room: narrow, “Page 6 of 24”; wide, one more neighbour on each side.

Use it for

  • Moving through pages of results when the total is known.

Not for

  • Large live datasets (a virtualised data grid).
  • Feeds (load more or infinite scroll).

Anatomy

  • range text
  • previous
  • page numbers with gaps
  • next

States

  • first page
  • middle
  • last page
  • narrow room (compact: “Page 6 of 24”)
  • wide room (one more neighbour each side)

Keyboard

  • Tab through the buttons; the current page carries aria-current

Motion

The current page's plate travels to the next page chosen as matter (ui/lib/contour.ts). In the middle of a long list the window keeps the current page in its middle slot, so the plate stays and the numbers slide one slot under it (useFlip): the ones that stay keep their path, the one arriving grows in. A change of room swaps numbers and compact text at the container step, no window breakpoint. Reduced motion places everything at once.

Props

PropTypeDefaultDescription
pagenumber—Controlled current page, counted from 1; omit to use defaultPage.
pageCountnumber—Number of pages for existing callers; omit when rowCount is supplied.
onPageChange((page: number) => void)—Reports page number after a change; no callback by default.
siblingsnumber1Pages shown on each side of the current one. Default 1.
pageWindow(page, count, siblings)function—The numbers shown, in a fixed number of slots (2 × siblings + 5) so Next and Previous never move; every page when there are that few; a gap always stands for two or more pages.
classNamesPaginationClassNames—Classes for the named visual parts; no part overrides by default.
style / refCSSProperties / native Ref—style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default.
pageSizenumber—With both, a line like "41–60 of 468" sits before the pages.
totalnumber | null—Deprecated: Use rowCount.
labelstring—The landmark's name. Default "Pagination".
classNamestring—Classes on the documented visual root; no override by default.
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.
refRef<HTMLElement>—Receives the documented root element; no ref by default.
defaultPagenumber—Initial page when uncontrolled, counted from 1. Defaults to 1.
rowCountnumber | null—Total matching rows; null is unknown. Overrides deprecated total.
defaultPageSizenumber—Initial rows per page. Default 25 when rowCount is supplied.
onPageSizeChange((pageSize: number) => void)—
hasMoreboolean—Unknown totals: false disables Next.

Built from

Used in

Dependencies

lucide-react

Import

import { Pagination } from "@beamline/pagination";

Get it

Pagination is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Pagination is included in the free MIT sample. Get Beamline · Connect your agent

More in Navigation

  • Sidebar: The app's main navigation: sections, items with counts and one level of sub-pages, an icon rail with tooltips (⌘B, the trigger or the edge), and a sheet…
  • Tree view: Nested folders and records with the full tree keyboard model (arrows, Home/End, *, type to jump), depth guides, counts and animated opening.
  • Stepper: Where someone is in a multi-step flow: done steps carry a check, the current one a ring, and the line between marks fills as steps complete.
  • Table of contents: The sections of a long page beside it, with the one being read marked as you scroll: the marker travels down the rail between sections, the rail fills…
  • Tabs: Switches between panels of one object; one indicator slides to the active tab, counts sit beside labels, and the tabs a row has no room for fold into More.
  • Navigation menu: A site or docs header whose sections open into one panel that resizes and slides between them; NavigationMenuCard is the standard link row.
  • Menu bar: A desktop-style File / Edit / View bar for editor-like apps; each menu takes the same rows as the dropdown menu, and pointing moves between open menus.
  • User menu: The account menu behind the avatar: who is signed in, status, theme, account pages and sign out with progress; a bottom sheet on phones.
  • Breadcrumb: Where a page sits and the way back up; it shows as many levels as its room holds and folds the ones nearest the top into a menu.

Guides: Connect a React app to your backend with Beamline UI

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.