About the shadcn/ui Pagination Component
The Pagination component is part of shadcn/ui — a collection of accessible, copy-paste React components built with Radix UI and Tailwind CSS. Install it with `npx shadcn@latest add pagination` and copy it directly into your project.
Pagination Component — Frequently Asked Questions
How do I control which page is active in shadcn Pagination?
The Pagination component renders links — control via URL params. Use `useSearchParams` to read `?page=3` and highlight `<PaginationLink isActive>` when `page === currentPage`.
How do I add ellipsis to shadcn Pagination for large page counts?
Use `<PaginationEllipsis>` between page groups. For example, show pages 1, 2, 3, `...`, 98, 99, 100. Calculate which pages to show based on the current page.
How do I make shadcn Pagination work with TanStack Table?
Use `table.getState().pagination.pageIndex` for current page and `table.getPageCount()` for total pages. Call `table.setPageIndex(n)` on page link clicks.