Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Tabbed Sections Reviews Block for React

Eighteen reviews of a sewing machine sorted into four tabs, Most recent, Most helpful, Critical and Verified, each with its derived count and three reviews.

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

Tabbed review sections for React with Base UI, for Bobbinmill, a fictional sewing machine. A centred header gives the count and the average (worked out from the eighteen typed reviews), and a band of line tabs under a rule with + marks offers four groups: Most recent, Most helpful, Critical (one and two stars) and Verified purchases. Each tab carries its count, derived from the reviews, and its panel opens with a line saying which three it shows ("3 of the 4 reviews rated 1 or 2 stars, newest first") above three ruled review rows with the reviewer, the stars, the title and the text. Every panel is drawn once more, unseen, in the same cell, so switching tabs never moves the page. On a phone the tab list scrolls sideways. It's built from Tabs, Badge, Rating, Avatar and Guides.

FAQ

How do I change the tabs?

Each group is a typed list at the top of the file: RECENT, HELPFUL, CRITICAL and VERIFIED are built from REVIEWS with a sort or a filter, and TABS gives each a label, a count, a note and the three rows shown (SHOWN). Add a tab by adding an entry to TABS; the trigger, the count and the panel come from it. The "With photos" tab of other review lists is left out, since no review here carries a photo.

Where do the counts come from?

From the length of each group: all 18 reviews for the first two tabs, the reviews rated 1 or 2 stars for Critical, and the verified purchases for the last. Tab names include the count for screen readers ("Critical 4 reviews").

Why doesn't the page move when I switch tabs?

All four panels are drawn together, unseen, in the same grid cell, and the live panel sits on top of them, so the cell keeps the height of the tallest panel. The unseen copies are hidden from assistive technology and the keyboard.

How does it work with a keyboard?

The tab list is one tab stop; the arrow keys move between tabs and Home and End jump to the ends. The panel follows the selected tab, and each review keeps its title as an h3 under the section's h2. Tabs select as they receive focus.

How does it fit on a phone?

The four tabs scroll sideways inside the band, with the selected one kept in view, and each panel's rows stack the reviewer above the text. Nothing scrolls the page sideways at 320 pixels.

  • 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

    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

    Compact List Reviews

    Lists and pages

    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.

  • Pro

    Three numbered pin slots for a bookshelf's reviews: pin from a list, move a pin up or down, unpin it, or replace a full slot through a Select.

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