Pagination
Links between the pages of a list: previous, next, the page numbers, and gaps for the pages in between.
Installation
Or with the shadcn CLI, from the registry:
Usage
Sizes and the first page
size on Pagination sets every link at once: square buttons for the numbers, matching heights for Previous and
Next. On the first or last page, give the link aria-disabled="true" and no href: it dims and stops clicks.
Links are <a>s; give your router's link in render (render={<Link to="?page=2" />}), as with
Breadcrumb.
Villages
The links are buttons, ghost with the current page outlined, so they take the village's radius, border and press.
Accessibility
- A
<nav>landmark named "Pagination" (change it witharia-labelwhen a page has several). - The current page carries
aria-current="page". Previous and Next are named "Go to the previous page" and "Go to the next page"; on phones their words are hidden and the chevrons stay. - The ellipsis is read as "More pages".
API reference
| Component | Props |
|---|---|
Pagination | The props of <nav>, plus size: "sm" | "default" | "lg" (default "default") |
PaginationContent, PaginationItem | The props of <ul> and <li> |
PaginationLink | The props of <a>, plus isActive, size (a Button size, overriding Pagination's) and render |
PaginationPrevious, PaginationNext | As PaginationLink; children replace the words |
PaginationEllipsis | The props of <span> |