Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Snippet Cards Reviews Block for React

Eight review snippet cards on shared hairlines for a yoga mat: each leads with its most helpful sentence, and a Sheet opens the whole review with Previous and Next buttons and a polite counter.

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

Snippet cards for React with Base UI, for the Linnhouse Flow, a fictional yoga mat. A compact header holds the title and one sentence over eight cards on shared hairlines, two across from the medium breakpoint, the first and the last a full row wide. Each card shows the read-only stars with their value in words, the mat's colour and thickness as an outline tag, the review's most helpful sentence in large type, the reviewer with an initials avatar, a "Verified purchase" mark in words and a fixed date, and a "Read the full review" button. The button opens one Sheet with the whole article: stars, title, colour and size, the full text with the card's sentence underlined, the reviewer, Previous and Next buttons that wrap around, and a "3 of 8" counter that a screen reader hears politely. Closing the Sheet returns focus to the card of the review last read. On a phone the cards are one column, the first four show, and a button reveals the other four. The snippets are typed, word for word from each review, and the underline in the Sheet finds them in the text. It's built from Sheet, Rating, Badge, Avatar, Button and Guides.

FAQ

Where does the snippet on each card come from?

It is typed: each review in REVIEWS has a snippet, the sentence readers found most helpful, copied word for word from its body. Nothing picks it live. The Sheet splits the body around the snippet with indexOf, so keep the snippet an exact piece of the body; if it is not found, the Sheet shows the body without an underline.

How do I use my own reviews?

Replace REVIEWS at the top of the file, newest first. Each review has an id, name, rating from 1 to 5, an ISO date, a title, a body, a snippet, a variant (the tag on the card) and verified. The count in the header, the "3 of 8" and the phone's "Show 4 more reviews" all come from the length of that list; PHONE_FIRST sets how many cards a phone shows at first.

How does the Sheet behave?

It slides in from the end of the line, names itself with the review's title and traps focus until closed. Previous and Next wrap around, so you can read all eight without closing it, and the polite line reads the title and the place ("Thin, but it grips, 3 of 8"). Escape and the close button both return focus to the card of the review you last read, even if you stepped away from the one that opened it.

Why are the first and last cards wider?

Eight cards two across would leave no variety, and an odd count would leave an empty cell. The first and last take the full row, and the six between them pair up, so every row is full on every screen size. The hairlines between them are the grid's one-pixel gap over a border-coloured background.

What does a phone see?

One column, the first four cards, then a ghost button that reveals the other four and says "Show fewer reviews" afterwards (aria-expanded and aria-controls are set). The Sheet is full width.

Does it work right to left?

Yes. The Sheet opens from the start side of the line, its close button and chevrons mirror, and dates and counts are isolated so digits keep their order.

  • Pro

    A framed carousel of five editor's picks for a desk chair, each chosen by a rule worked out from ten typed reviews: most helpful, most detailed, best critical, newest verified and longest owned.

  • 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

    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

    Masonry Layout Reviews

    Cards and walls

    Twelve reviews of pruning shears as cards of every length in CSS columns, with a star filter, an order switch, a polite count and a Helpful vote on each card.

  • Pro

    A quote-only bento drawn with hairlines: one large lead story beside four shorter quotes, in cells that share their lines, on the page's drafting lines.

  • Pro

    A two-thumb star range picks which of a camera bag's 13 reviews you read, one full review at a time, with Previous and Next buttons, the arrow keys and a Review 2 of 10 counter.