Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Comment Thread Social Feed Gallery Block for React

A neighbourhood feed in a scroll area: three posts with likes, a thread that opens in place and a form that adds your comment for this visit.

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 social feed gallery for React with Base UI. A split: at the start, the title, a sentence and three live totals (posts, likes, comments) that follow what you do; at the end, the feed in a hairline frame with corner marks, a scroll area of fixed height holding three posts. Each post has an author with initials, a fixed date, a drawn picture, a caption, a like Toggle with its count and a comment button that opens the thread in place. The thread lists the comments and a real form adds yours: it appears at once, marked "posted for this visit", and nothing is sent. On a phone the feed comes first and the totals under it. The pictures are drawn in the theme's greys, never photographed. It's built from Guides, Scroll Area, Toggle, Collapsible, Input, Avatar and Button, with CSS transitions for the entrance. For community apps, neighbourhood boards and any feed with short threads.

FAQ

How do likes work?

Each post has a pressed Toggle with the post's count and yours added: pressing it adds one, pressing again takes it back, and the total in the start column follows. The state is local; connect like to your service to store it.

What does posting a comment do?

It adds your comment to the end of that post's thread, marked "posted for this visit", empties the field and announces it politely. It goes nowhere: it is gone when the page reloads. Connect post to your service to keep it.

Why is the feed in a scroll area?

So the block keeps a fixed height whatever the posts and threads do. The scroll area scrolls with the wheel, touch and the keyboard (Tab into a post and use Page Down, or the arrow keys on a focused post's area), and a thread that opens grows inside it.

What if I post an empty comment?

The Post button is disabled while the field is empty and a submit with nothing in it does nothing, so there is no error to handle.

Which keys work?

Tab goes through each post's like button, its comment button and, when the thread is open, the field and Post. Space or Enter presses the buttons; Enter in the field posts. Closed threads are out of the tab order.

How do I use photographs?

Each post's picture is a scene; replace Scene with an <img> that has the same box and keep the description as its alt text.

  • Pro

    A drawing-sharing profile: an avatar, a bio, posts, followers and following, a Follow toggle that adds one, and Posts, Reels and Saved tabs over a three-column square grid that opens one viewer.

  • Pro

    Stories Gallery

    Carousels and slides

    A tray of six round highlights for a day-journal app that opens a full-screen viewer with segmented progress bars, tap zones, Previous and Next, a Pause toggle, auto-advance and focus that returns to the highlight.

  • Pro

    A photo essay of five framed pictures in alternating rows, with a Short and Full switch: Short shows each title, Full adds the place, date, credit and a two-sentence story.

  • Pro

    Six dishes with a five-star rating each, a seeded average and count that your vote joins, and a Sort group for top rated and most rated.

  • Pro

    A framed wall of a camera club's six newest entries under Latest and Featured tabs, beside a real form with a handle, a caption and a file drop zone that puts your entry first as pending review for this visit, never posting anything.

  • Pro

    Reading List Blog

    Reading tools

    Five saved articles with a bookmark toggle on each: un-saving strikes the row through in place with an Undo link, and the foot reads the derived totals, like 5 saved, 46 min to read.