shadcn.io is not affiliated with official shadcn/ui
Pagination examples · Advanced
Both Ellipsis Pagination for React
Pagination on page 6 of 20, with an ellipsis on each side of the current page's neighbors.
Deep in a long list: the first page, an ellipsis, pages 5 to 7 with page 6 current, another ellipsis and the last page, page 20, between Previous and Next. The row stays the same width wherever the current page is.
Preview
Installation
FAQ
Which pages does this row show?
PaginationPrevious, page 1, a PaginationEllipsis, pages 5, 6 and 7, a second PaginationEllipsis, page 20, and PaginationNext. Page 6 has isActive, so that link is outline and aria-current="page".
Why are there two ellipses?
The numbers are written out by hand. One PaginationEllipsis sits after page 1, and the other sits before page 20. Each is an aria-hidden span with a more-horizontal icon, not a link.
How do I move the current page?
Change 5, 6 and 7, and put isActive on the current PaginationLink. Leave the links for 1 and 20 at the ends, with an ellipsis in each gap.
How do I give each control a real URL?
Every href here is #. Set href on PaginationPrevious, each numbered PaginationLink, and PaginationNext.
Related
- Start Ellipsis PaginationPagination near the end, with an ellipsis
- End Ellipsis PaginationPagination near the start, with an
- Many Pages PaginationTen page numbers in a row with page 5 as
- Disabled State PaginationPagination on the first page, with
- Basic Data Table with CheckboxesA table of products with a checkbox on
- Complete PaginationPagination with Previous and Next, the