Skip to main content

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 bar
Live demo
Open ↗

When 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​

PropTypeRequiredDescription
pagenumberYesThe current page, 1-based.
pageCountnumberYesTotal 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).
hrefTemplatestring—Used when getHref isn't given: "{page}" is replaced. Default "?page={page}".
siblingCountnumber—Numbers either side of the current page. Default 1.
boundaryCountnumber—Numbers kept at each end. Default 1.
labelstring—Accessible name of the nav landmark. Default "Pagination".
previousLabelReact.ReactNode—Default "Previous".
nextLabelReact.ReactNode—Default "Next".
linkComponentLinkComponent—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.
classNamestring—