Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Compact List Reviews Block for React

Twelve 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.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A compact list of reviews for React with Base UI, for Gleangate, a fictional notes app. A start-aligned header states the count and the average (both worked out from the twelve typed reviews) and carries a Select at its end that orders the rows. Under it a real table runs from rail to rail beneath a rule with + marks: the rating as stars and a number, the title over a one-line excerpt, the reviewer with a verified mark, the date and the helpful count. Everything is visible and nothing opens. The Rating, Reviewer, Date and Helpful column heads are buttons that sort the same table and set aria-sort, and a polite line says which order is on. On a phone the Reviewer and Date columns drop and the rating becomes one star and a number. It's built from Select, Rating, Guides and the Button styles.

FAQ

How do I use my own reviews?

Edit REVIEWS at the top of the file: each entry has an id, the name, a rating from 1 to 5, an ISO date, a title, a one to three sentence body, verified and a helpful count. The count and the average in the header are computed from the array, so they follow your edits. Dates are fixed text, never computed from today.

How does sorting work, and is it announced?

Each of the four sortable column heads is a button inside its th. The first press sorts a column biggest first (names A to Z), the next reverses it, and the th carries aria-sort="ascending", "descending" or "none". The Select lists all eight orders and always shows the one in force, so the two controls stay in step. A polite status line, hidden from sight, says "Sorted by newest first." after every change. Ties fall back to the newest review, so the order never flickers.

Why is the table a native table?

It needs a caption, column headers with scope and aria-sort, and a column set that drops on a phone, and a plain table gives all of that the same way on every library. The scroll region around it is named and reachable by keyboard.

What changes on a phone?

Below the md breakpoint the Reviewer and Date columns are hidden, the stars become a single star beside the number, and each row keeps its title and one-line excerpt. The Select, which mirrors the sort at every width, is the way to order the rows by date there.

Does it work right to left?

Yes. Columns, the sort arrows and the end-aligned figures follow the page's direction, and dates, ratings and counts are isolated in bdi so their digits keep their order.

  • Pro

    Paginated List Reviews

    Lists and pages

    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'.

  • Pro

    Twenty 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

    Twelve reviews of an interior paint as accordion rows: stars, title, excerpt and byline when closed; the whole review, a Helpful vote and the seller's reply when open.

  • Pro

    Filter Sort Bar Reviews

    Filter and search

    A toolbar band for rain-jacket reviews: a rating Select, a Verified toggle, a date Popover and a sort Select, a live count with removable chips, and the matching reviews as ruled rows.

  • Pro

    Advanced Sort Reviews

    Filter and search

    A 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

    A 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.