Navigation
Pagination
Move through long collections.
Usage
Compose the control from PaginationLinks and let usePagination decide which numbers and ellipses to show. The list keeps the same length while you page, so the control never changes width.
Showing 51 to 60 of 117 invoices
When to use
- Collections where people look for a specific position: invoices, search results, logs.
- Server-paged data, where each page is a URL (use links, so it can be shared and crawled).
Not for: feeds (infinite scroll or “Load more”), or fewer than two pages of results.
Compact
When space is short, replace the numbers with PaginationStatus: “Page 3 of 12”. On phones, Previous and Next also collapse to arrows.
As links
Give PaginationLink an href for a plain anchor, or use asChild with a Next.js Link. The pure function getPaginationRange works on the server.
API
usePagination(options)
| Prop | Type | Default | Description |
|---|---|---|---|
| page | number | — | Current page, 1-based. |
| total | number | — | Number of pages. |
| siblings | number | 1 | Pages on each side of the current one. |
| boundaries | number | 1 | Pages always shown at each end. |
Returns an array of page numbers and the strings 'ellipsis-start' / 'ellipsis-end'.
PaginationLink
| Prop | Type | Default | Description |
|---|---|---|---|
| isActive | boolean | false | The current page: aria-current="page" and the filled style. |
| disabled | boolean | false | First / last page: stays in the layout, ignores clicks. |
| href | string | — | Renders an anchor. Without it the link is a button. |
| size | 'icon' | 'default' | 'icon' | Square for numbers, wide for Previous / Next. |
| asChild | boolean | false | Render the child element (e.g. Next.js Link). |
PaginationPrevious and PaginationNext take the same props with an arrow and a label. PaginationStatus takes page and total.
Keyboard
| Key | Action |
|---|---|
| Tab | Moves between the links; disabled ones are skipped. |
| Enter | Goes to the page. |
| Space | Goes to the page (buttons). |
Accessibility
- A nav landmark labelled “Pagination” holding a list. The current page has aria-current="page".
- Give page numbers an aria-label such as “Page 6”; Previous and Next are labelled for you.
- The status text is a polite live region, so a page change is announced.
Motion
- Presses scale to .97 on the snappy spring; colours change in 150ms.
- Reduced motion drops the press scale.