Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Split View Reviews Block for React

A master and detail split for six monitor reviews: a list where each row is a checkbox, a pane that shows the one you tick in full, or two side by side with a 'Both mention' line, and arrow keys that move between rows.

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 review split view for React with Base UI, for the Plinthmoor 27, a fictional 27-inch monitor. Behind a divider, the start holds six reviews as a list where each row is a checkbox with the stars, the title, the reviewer and the date; the end holds a pane. Tick a review and the pane shows it in full: stars with their value in words, the text, the reviewer with a "Verified purchase" mark, the topics it mentions and the seller's reply when there is one. Tick a second and the pane shows the two side by side with a "Both mention" line worked out from the topics each carries; a third tick drops the oldest of the two. Up and Down move between the rows, and a polite line says what the pane shows. An unseen copy of every pane shares its cell on a desktop, so ticking never moves the page. On a phone the pane sits under the list. It uses Checkbox, Label, Rating, Badge and Guides, with CSS transitions only.

FAQ

How does the comparison work?

Each row is a checkbox in a Label, so the whole row is the target. The first tick shows that review in the pane; a second shows both in two columns on a desktop (stacked on a phone); a third unticks the oldest tick so there are never more than two, and the status line says which two. The "Both mention" line is the topics that appear in both reviews' mentions, or "No topic in common". Unticking the only picked review is ignored, with a note, so the pane is never empty.

How do the keyboard shortcuts work?

Tab reaches the first checkbox; Space ticks it. Up and Down move focus to the checkbox above or below without ticking, as a shortcut over the rows: the checkboxes stay the normal way in, so a screen reader or a switch device works without it. Tab and Shift+Tab still walk the rows one by one.

Why doesn't the pane change height?

On a desktop, the live pane and an unseen copy of every pair of reviews (and of the longest one alone) share one grid cell, so the cell is always as tall as the biggest case. Nothing below it moves whichever review you tick. The copy is aria-hidden and inert. On a phone the copy is hidden, because the pane is the last thing and the extra space would only show as a gap.

How do I use my own reviews?

Edit REVIEWS at the top of the file: each has a title, text, rating, date, mentions (the topics it talks about, which the shared line compares), and an optional reply. The list order is the array order, the average in the header is worked out from the ratings, and the pane's height comes from the longest reviews, so a longer review needs no extra styling.

Does it work right to left?

Yes. The list sits at the start, the divider and the seller reply's rail use logical sides, and the dates and ratings are wrapped so their digits stay in order. The arrow keys move through the rows in either direction because they follow the list's order, not the screen's.

  • Pro

    Reply Thread Reviews

    Votes and replies

    One three-star dishwasher review with its conversation in a single framed window: the seller's reply, the buyer's follow-up and the seller again under depth rails, and a real reply form with a live character count that appends your reply to the end.

  • 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

    Two blenders chosen with two Selects and set side by side: scores, review counts, five criterion rows with the higher score marked by bold, a check and the word Higher, and one pro, one con and one quote each.

  • 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

    Questions about a pressure cooker answered by people who own one: a search box and an All, Answered or Unanswered group, answers with the seller's pinned first, a Helpful toggle on each, an inline answer form and an Ask a question dialog.

  • Pro

    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.