shadcn.io is not affiliated with official shadcn/ui
Paginated List Reviews Block for Radix UI
Twenty-four reviews of a cookbook five to a page, with a page-size Select, the catalog pagination with ellipsis and a polite 'Showing 6 to 10 of 24'.
Installation
Overview
A paginated list of reviews for React with Radix UI, for Ember & Rye, a fictional cookbook of wood-fired breads. A centred header gives the count and the average (worked out from the twenty-four typed reviews), then a thin toolbar band holds the page's own heading, "Reviews 6 to 10", and a Select for 3, 5 or 10 reviews per page. Ruled rows run from rail to rail, each with the reviewer, the stars with their value in words, the title and the text. A closing band ends the block with a polite "Showing 6 to 10 of 24" and the catalog Pagination with ellipsis. Choosing a page moves focus to the heading, and every page is drawn once more, unseen, so the pager never moves. It's built from Pagination, Select, Rating, Avatar and Guides.
FAQ
How do I change the page sizes?
Edit SIZES (the labels and values the Select shows) and the first useState(5) for the default. Changing the size returns to page 1. The number of pages, the "Showing" line and the heading are all computed from REVIEWS and the size, so adding a review needs no other edit.
How does the pager handle many pages?
Up to seven pages it draws every number. Past that it draws seven slots, the first, the last and a window around the current page with an ellipsis on each side it skips, so the pager keeps its width as you move through it. Previous and Next dim and leave the tab order at the ends.
Where does focus go when the page changes?
To the "Reviews 6 to 10" heading above the list, so a keyboard or screen reader user lands just before the new reviews. The status line also announces the new range. Page numbers are real links to ?page=n; the click swaps the rows in place.