Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Social Feed

ProNew

One feed for posts from Facebook, X, LinkedIn, Pinterest, TikTok, Tumblr and any other network: a profile header with Follow, post cards with text, media and counts in a grid, masonry, timeline or carousel, and a popup for the full post.

Installation

pnpm dlx shadcn@latest add @viewport/social-feed

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
posts*SocialPost[]—
profileSocialProfile

Adds a header with avatar, name, stats and a Follow button.

—
layout"grid" | "masonry" | "list" | "carousel"

`grid` aligns equal cards, `masonry` packs cards of their own height, `list` is one timeline column, `carousel` is a row you swipe or page through.

"grid"
columns2 | 3 | 4

Cards per row on wide containers. Narrow ones drop to two, then one.

3
filterboolean

Shows a filter pill per network. Needs posts from at least two.

true
linesnumber

Lines of text before a card is cut with "Read more".

4
pageSizenumber

Cards shown before "Load more". The carousel shows every post.

6
popupboolean

Opens posts in a popup. Off, cards link straight to the network.

true
followingboolean

Whether the visitor follows the profile. Leave it out to let the button keep its own state.

—
onFollow(following: boolean) => void

Called by the Follow button. Without it, the button is a link to the profile.

—
loadingboolean

Shows placeholders while you fetch the feed.

—
classNamestring—

Accessibility

  • Each post is an `article` with one button named "Post by Slow Roads on Facebook, 2 hours ago"; the network mark has a text name and counts are read as "1.3K likes".
  • The popup is a modal dialog titled by the author: it traps focus, closes on Escape, returns focus to the card, and Left and Right arrows move between posts.
  • The carousel is a focusable scroll region with scroll-snap, so it swipes on touch; its arrows disable at each end and the page dots are named buttons with `aria-current`.
  • Network filters and Follow are toggle buttons with `aria-pressed`; loading announces "Loading posts" while placeholders show.
  • Card entrance, media zoom, the sliding filter pill and the dialog animation are dropped under `prefers-reduced-motion`.