React Pagination Component
A React pagination component with page numbers, ellipses and first, previous, next and last buttons in a labeled navigation landmark.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/pagination.jsonResults 1 to 10
PaginationgetPageItemsdefaultPaginationLabels- +1 more
Controlled pagination
Page numbers with ellipses; first, previous, next and last buttons.
Current page: 6
import { useState } from "react";
import { Pagination } from "@/components/sheenui/pagination/pagination";
// Package build (after the first npm release, or a packed tarball): import { Pagination } from "@sheenui/theme";
export function Example() {
const [page, setPage] = useState(6);
return <Pagination page={page} onPageChange={setPage} pageCount={32} />;
}Files to copy
5 folders · 6 files · 3 packages
- From
theme/src/ components/pagination/hooks/{use-controllable.ts, use-media-query.ts, use-preferences.ts}motion/tokens.tslib/{cn.ts, warn-once.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/pagination.jsonRegistry item: pagination. The styles need the Tailwind v4 glass UI setup.- Packages
pnpm add clsx motion tailwind-merge
Props
PaginationLabels keys and English defaults (8)
When to use pagination
Use pagination under a long list or table when people need to know where they are and jump to a position: search results, an orders table, an admin list. The data table already uses it in its footer. Prefer infinite scroll or a load-more button only when position does not matter, and prefer a combobox with search when the goal is finding one item.
Keep the page size predictable: a bar with seven slots (first and last page, the current one with a neighbor on each side, and two ellipses) fits a phone, and on small screens the control switches to the compact "Page 3 of 32" text. Disable it while a request is in flight so a second click cannot start a second request, and reset to page 1 whenever a filter changes.
Pair it with the React data table for server-side paging, with skeleton rows while a page loads, and with breadcrumbs for orientation.
Frequently asked questions
All exports on this page
Pagination— Pagination: page numbers with ellipses, first / previous / next / last, in a labelled <nav> landmark.defaultPaginationLabels— Default English strings of PaginationLabels; spread it and override single keys to reword.getPageItems— The page slots to show (1-based).
Keyboard
Accessibility
- The control is a <nav> landmark named “Pagination”; give each pagination on a page its own aria-label.
- The current page has aria-current="page"; every page button is named “Page 3”, and ellipses read “More pages”.
- While disabled, nothing can be activated; on touch the targets are 44px; every string is in labels.
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .