Pagination
Showing 251–300 of 2,384 audit events
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/pagination.jsonUsage
import { Pagination } from "@/components/ui/pagination"
<Pagination pageCount={24} page={page} onPageChange={setPage} />Examples
Compact
variant="compact" shows "Page 3 of 12" between the arrows. The number rolls in the direction you moved.
Sizes
32, 40 and 48 px, matching Button and Input.
Links
Pass getHref and every page becomes a real link, so it works without JavaScript and opens in a new tab. siblingCount widens the window.
API reference
Renders a nav labelled "Pagination" and accepts every native attribute.
| Prop | Type | Default |
|---|---|---|
pageCount | numberTotal number of pages. Values below 1 count as 1. | None |
page | numberCurrent page (1-based) when controlled. | None |
defaultPage | numberInitial page when uncontrolled. | 1 |
onPageChange | (page: number) => voidCalled with the new page when the user picks one. | None |
siblingCount | numberPages shown on each side of the current one. | 1 |
boundaryCount | numberPages always shown at the start and the end. | 1 |
getHref | (page: number) => stringRender links instead of buttons. Plain clicks still call onPageChange; modified clicks are left to the browser. | None |
variant | "default"Unset: page numbers from sm up and the compact layout below it. Set it to pin one layout. | None |
size | "sm"Control height: 32, 40 or 48 px. | "md" |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
aria-label | stringName of the navigation landmark. Give each one a distinct name when a page has several. | "Pagination" |
Accessibility
- The control is a nav landmark named "Pagination"; the current page has aria-current="page".
- Previous and next are labelled "Previous page" and "Next page" and are disabled at the ends. As links, they drop their href and set aria-disabled.
- Page buttons are named "Page 3" and so on. The ellipsis is hidden from screen readers and is not focusable.
- When the window slides after you pick a page, focus follows that page to its new slot.
- The compact layout announces "Page 3 of 12" through a polite live region when the page changes.
- With reduced motion the indicator and the numbers jump instead of gliding.