shadcn.io is not affiliated with official shadcn/ui
Paginated List Reviews Block for React
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 Base 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.
Related
- Pro
Infinite Scroll Reviews
Lists and pagesTwenty reviews of a podcast app ten at a time in a fixed-height scroll region that appends five more at its end, with a Load more button, placeholder rows and a polite count.
- Pro
Compact List Reviews
Lists and pagesTwelve one-line reviews of a notes app as a real table with sortable column heads, a Select that mirrors the sort, and nothing to open.
- Pro
Tabbed Sections Reviews
Lists and pagesEighteen reviews of a sewing machine sorted into four tabs, Most recent, Most helpful, Critical and Verified, each with its derived count and three reviews.
- Pro
Advanced Sort Reviews
Filter and searchA filter panel for tent reviews: a sort key, an order, star pills, a recency segment and a verified Switch beside the matching reviews, with removable chips, a live count and a bottom Sheet on phones.
- Pro
Rating Breakdown Reviews
Score summariesA review summary for a carry-on suitcase whose star rows filter the reviews: the average, the count, the share that would recommend it and a five-row distribution, beside the four most helpful reviews with a Helpful vote each.
- Pro
Pagination Blog
Post listsA transit-planning blog's archive as rows, four to a page over three pages, with the catalog pagination in a band at the foot, a polite 'Showing 5 to 8 of 12' line and a height that never changes between pages.