ComponentsNavigation

Pagination

Page through long lists. Numbered pages with a stable width, a table footer bar with "1–20 of 312" and rows per page, SEO-friendly links, and cursor paging for APIs without a total.

components/pagination.tsxtheme · material · accent · density · font

Installation

$ pnpm add @vamos-ui/react

The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";

Usage

import { Pagination, PaginationBar } from "@vamos-ui/react";

<Pagination page={page} pageCount={52} onPageChange={setPage} />
<PaginationBar total={312} page={page} pageSize={20} onPageChange={setPage} onPageSizeChange={setPageSize} />

Moving focus to the top of the list after a page change is your app's job — focus the table caption or heading.

Examples

Table footer (HR)

PaginationBar formats the range with Intl and the locale. Changing the page size keeps the first visible row on screen.

EmployeeRoleID
Ayşe DemirAccount executiveE-1001
Jonas WeberSupport leadE-1002
Priya NairProduct designerE-1003
Lucas MartinPayroll specialistE-1004
Sofia RossiAccount executiveE-1005

1–5 of 312

Variants and sizes

numbers, compact ("3 / 24") and simple (Previous / Next). Below 640px numbers shows as compact through CSS.

Cursor-based (CRM)

CursorPagination for APIs that only know whether there is a next page. The pressed button shows the spinner.

Loading

loading puts a spinner on the current page and locks the controls until the next page arrives.

API

Pagination

PropTypeDefault
page
Required. Current page, 1-based.
number—
pageCount
Required. Number of pages.
number—
onPageChange
Called with the requested page.
(page: number) => void—
getHref
Render links instead of buttons (websites, SEO).
(page: number) => string—
siblingCount
Pages on each side of the current one.
number1
boundaryCount
Pages always shown at the start and end.
number1
variant
Numbered, "3 / 52" with arrows, or Previous / Next.
"numbers" | "compact" | "simple""numbers"
size
md follows --control-h.
"sm" | "md""md"
hideOnSinglePage
Render nothing when pageCount ≤ 1.
booleantrue
loading
Spinner on the current page; controls locked.
booleanfalse
labels
Overrides: label, previous, next, previousPage, nextPage, goTo ("Page {page}"), page, range, pageSize, morePages, empty.
Partial<PaginationLabels>—

PaginationBar

PropTypeDefault
total
Required. Total rows.
number—
pageSize
Required. Rows per page.
number—
pageSizeOptions
Choices for rows per page; [] hides the picker.
number[][10, 20, 50, 100]
onPageSizeChange
Shows the rows-per-page picker when set.
(size: number) => void—
page · onPageChange · size · labels · getHref
As on Pagination; pageCount is computed.
——

CursorPagination

PropTypeDefault
hasPrev · hasNext
Required. Enable the buttons.
boolean—
onPrev · onNext
Called on click.
() => void—
loading
Locks both; spinner on the pressed one.
booleanfalse
status
Text between the buttons.
ReactNode—

usePaginationRange / paginationRange

PropTypeDefault
{ page, pageCount, siblingCount?, boundaryCount? }
Returns the items to render: numbers plus "ellipsis-start" / "ellipsis-end". Constant length while paging.
PaginationRangeOptions—

Primitives

PropTypeDefault
PaginationList · PaginationItem
Layout parts.
ul · li—
PaginationLink
Router Link with href, otherwise a button.
{ href?; isActive?; disabled?; loading? }—
PaginationPrevious · PaginationNext
Arrows (flip in RTL), named "Previous page" / "Next page".
PaginationLink + { showLabel? }—
PaginationEllipsis
"…" announced as "More pages".
span—