shadcn.io is not affiliated with official shadcn/ui
Components
Free
Pagination for React
Links for previous, page numbers, and next on a long list, with the current page marked. For React with Base UI, when the list does not fit in one view.
Framework
UI library
Page numbers, with previous and next, sit under a long list. The current page is marked.
Use it when a collection doesn't fit in one view. The path through the site is a Breadcrumb, not more pages of the same list. In React, Base UI renders a navigation landmark, and each page should keep its own address.
Installation
Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
Five page links and nothing else, with the current one marked isActive. Use a numbers-only row when there are few pages and a previous or next control would only widen it. Once the list runs long, add those ends and an ellipsis, which is the opening preview. isActive is also how assistive tech knows which page is current.
Icons Only
Previous and next, with no numbers, beside a rows-per-page Select. That is the compact footer of a data table, where stepping matters more than jumping. Use it when the table already shows a range and numbered links would repeat it. Keep the numbers when someone may need a far page, because stepping one page at a time is a poor way to get there.
Rtl
dir="rtl" flips the row, and text on previous and next replaces the English words with Arabic labels. The arrows follow the reading order, so previous stays at the start. Pass text whenever the visible word is not the default, because that string is also the accessible name. Numbers in the same script belong in this row too.
FAQ
How do I track the current page with the Base UI Pagination?
It's presentational: keep the current page in your state or in the URL, render the PaginationLinks around it yourself, and mark the current one with isActive.
How do I use Next.js Link or my router with Pagination in React?
Keep a real URL per page, so people can bookmark page 12 and search engines can follow it.
Open components/ui/pagination.tsx and render your router's link (Next.js Link, React Router's Link) where PaginationLink renders its a.
How do I show an ellipsis when Pagination has many pages?
Render the first and last pages, the current page's neighbors, and a PaginationEllipsis in each gap, rather than a link for every page.
Why can I still click Previous on the first page?
Pagination doesn't know your page count. Leave PaginationPrevious out on page 1 and PaginationNext out on the last page.
How do I show only Previous and Next buttons in Pagination?
Leave out the numbered PaginationLinks and keep PaginationPrevious and PaginationNext. The Icons Only demo above does that, with a rows-per-page Select beside them.
How do I change or translate the Pagination labels?
Pass text on PaginationPrevious and PaginationNext ("Previous" and "Next" by default). For a right-to-left language, set the direction too, as in the RTL demo, so the row and its arrows follow the reading order.
Is the Base UI Pagination accessible?
Yes. It renders a nav landmark labeled "pagination", Previous and Next carry labels for screen readers, and the current page's link gets aria-current="page", so assistive tech announces where you are.
How do I install Pagination in React?
Run the command from the Installation section above: it adds Pagination and the button it uses to your project's ui folder.
The shadcn CLI writes components/ui/pagination.tsx, a file you own and can edit.