Pagination
Previous / next plus page numbers, as links (server-renderable); collapses to "Page X of Y" on phones.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
Previous / next plus page numbers, as links (server-renderable); collapses to "Page X of Y" on phones.
Accessibility
Arrow keys move between items; the current item is marked aria-current. Tabs follow the WAI-ARIA tabs pattern (roving tabindex, Home/End).
Install and import
npx shadcn@latest add @prism/pagination
import { Pagination } from '@/components/prism/Pagination';
In a no-build prototype, read it from the bundle instead: const { Pagination } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
page | number | Yes | The current page, 1-based. |
pageCount | number | Yes | Total pages. Nothing renders when it's 1 or less. |
getHref | (page: number) => string | — | The href for a page. A function is fine from a Server Component (Pagination renders there). |
hrefTemplate | string | — | Used when getHref isn't given: "{page}" is replaced. Default "?page={page}". |
siblingCount | number | — | Numbers either side of the current page. Default 1. |
boundaryCount | number | — | Numbers kept at each end. Default 1. |
label | string | — | Accessible name of the nav landmark. Default "Pagination". |
previousLabel | React.ReactNode | — | Default "Previous". |
nextLabel | React.ReactNode | — | Default "Next". |
linkComponent | LinkComponent | — | Overrides LinkProvider's link component. |
onChange | (page: number) => void | — | Client-state mode: render buttons instead of links and call this with the new page (1-based). getHref / hrefTemplate are then ignored. |
className | string | — |