shadcn.io is not affiliated with official shadcn/ui
Pagination examples · Basic
With Ellipsis Pagination for React
Page numbers with an ellipsis before the last page, without Previous and Next.
Pages 1 to 3 with page 2 current, an ellipsis and the last page, page 10. It shows how far the list goes without listing every page, and leaves out Previous and Next to stay compact.
Preview
Installation
FAQ
What does this row render?
PaginationLinks for pages 1, 2 and 3, a PaginationEllipsis, and a link for page 10. Page 2 has isActive. There is no Previous or Next.
Is the ellipsis something people can press?
No. PaginationEllipsis is a span with aria-hidden and a more-horizontal icon. Pages 4 to 9 are left out of the row.
How do I mark a different page as current?
Move isActive to that PaginationLink. It sets the outline variant and aria-current="page". This file hardcodes 1, 2, 3 and 10, so edit those numbers too.
How do I link the numbered pages?
Each PaginationLink has href="#". Set it to that page's URL. The ellipsis has no href. The nav is labeled "pagination".
Related
- Complete PaginationPagination with Previous and Next, the
- Five Page Numbers PaginationFive page numbers with the middle one
- With Previous and Next PaginationThree page numbers between Previous and
- Simple Dropdown with Icons Dropdown MenuA short menu behind a dots button with an
- Simple Page Numbers PaginationThree page numbers with page 2 as the
- Both Ellipsis PaginationPagination on page 6 of 20, with an