shadcn.io is not affiliated with official shadcn/ui
Pagination examples · Basic
Complete Pagination for React
Pagination with Previous and Next, the first pages, an ellipsis and the last page.
The full row: Previous, pages 1 to 3 with page 2 current, an ellipsis for the pages in between, the last page and Next. People can step one page, jump to a nearby page, or go straight to the end. Use it for search results, product listings and archives.
Preview
Installation
FAQ
Which parts are in this pagination row?
PaginationPrevious, links for pages 1, 2 and 3, a PaginationEllipsis, a link for page 10, and PaginationNext. Page 2 has isActive, which uses the outline variant and sets aria-current="page".
How do I show a different set of pages?
Change the link text and move isActive to the current page. This file hardcodes 1, 2, 3, the ellipsis, and 10. Pagination is a nav labeled "pagination".
Is the ellipsis a link?
No. PaginationEllipsis is a span with aria-hidden and a more-horizontal icon. Here it occupies the gap where pages 4 to 9 are not rendered.
How do I point each control at a real URL?
Every href in this file is #. Set href on PaginationPrevious, each PaginationLink, and PaginationNext to that page's URL.
Related
- With Ellipsis PaginationPage numbers with an ellipsis before the
- With Previous and Next PaginationThree page numbers between Previous and
- Simple Page Numbers PaginationThree page numbers with page 2 as the
- Five Page Numbers PaginationFive page numbers with the middle one
- Both Ellipsis PaginationPagination on page 6 of 20, with an
- Disabled State PaginationPagination on the first page, with