Pagination
Move between pages of a long list or table.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/paginationComplete the one-time setup first. Registry JSON lists source files and dependencies.
Usage
import {
Pagination,
PaginationContent,
PaginationItem,
PaginationLink,
} from "@/siteplane/components/pagination";
<Pagination>
<PaginationContent>
<PaginationItem>
<PaginationLink active>1</PaginationLink>
</PaginationItem>
</PaginationContent>
</Pagination>;Composition
Pagination
└── PaginationContent
└── PaginationItem
└── PaginationPrevious / PaginationLink / PaginationNext / PaginationEllipsisCompact navigation
variant="ghost" hides the Previous and Next text and keeps icon buttons with their accessible names. Use it where space is tight, for example below a table.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
Pagination. | default | ghost | default | Directional navigation display. |
Pagination. | boolean | true | Active indicator motion; reduced motion is respected. |
Pagination. | Partial<PaginationLabels> | English | Replaces the words of the parts, each one on its own: navigation ("pagination", the landmark name), previous ("Previous"), previousPage ("Go to previous page"), next ("Next"), nextPage ("Go to next page") and morePages ("More pages"). Pass their translation when the application is in another language. |
Pagination | ul / li props | — | Content measures the active item; item supplies list semantics. |
Pagination | boolean | false | Sets aria-current="page" and the active indicator. isActive is a deprecated alias. |
Pagination | ButtonStandardProps["size"] | Icon size from provider | Explicit button size override. A page link is at least square, and a longer number widens it with 4 px on each side. |
Pagination | ButtonStandardProps | ghost button | Application owns navigation and disabled boundaries. |
Pagination | ButtonBaseProps & { active?: boolean } | size: provider / lg | Directional buttons with fixed icon and label from Pagination labels; default variant responds to viewport width. The chevrons mirror in a right-to-left page. |
Pagination | span props | — | Decorative gap, not a navigation action. |
Exported types: PaginationProps, PaginationLinkProps, PaginationLabels. These describe the props above.
Usage notes
No page count, slicing, URL state, or data fetching is built in. Set those in the application. The examples keep the current page in state: active marks the current link, onClick changes the page, and disabled stops Previous and Next at the first and last page. They also decide which page numbers to show; the first example always renders seven slots, so the control keeps its width while it pages. Root accepts native nav props. Link and direction controls inherit the corresponding Button API.
A page link keeps the square of its size for a short number. A longer one, such as 1,248, widens the link with 4 px on each side instead of filling the square edge to edge, and the active indicator follows its width. Format the numbers for the application's locale; the links show the text you pass.
labels replaces the words that Pagination renders, merged with the English defaults, for example labels={{ previous: "Zurück", previousPage: "Zur vorherigen Seite", next: "Weiter", nextPage: "Zur nächsten Seite" }}. An aria-label on PaginationPrevious or PaginationNext still replaces its accessible name. In a right-to-left page Previous sits on the right and Next on the left, and their chevrons point outward.