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

Instagram Feed

ProNew

A supplied-data Instagram-style profile feed: grid or slider photo tiles and opt-in masonry post cards, with profile stats, Follow and a popup with media, caption and comments.

Installation

pnpm dlx shadcn@latest add @viewport/instagram-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
profile*InstagramProfile—
posts*InstagramPost[]—
layout"grid" | "slider" | "masonry"

`grid` wraps square tiles, `slider` pages them, `masonry` adds post details below image cards.

"grid"
columns3 | 4 | 5 | 6

Tiles per row on wide containers. Narrow ones drop to three, two, or one for the slider.

4
gapnumber

Space between tiles, in pixels.

4
headerboolean

Shows the profile header.

true
popupboolean

Opens posts in a popup. Off, tiles link straight to Instagram.

true
pageSizenumber

Tiles shown before "Load more" in the grid.

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

—
onLike(post: InstagramPost, liked: boolean) => void

Called when a post is liked or unliked in the popup.

—
loadingboolean

Shows placeholders while you fetch the feed.

—
classNamestring—

Accessibility

  • Each tile is a button named by the photo's alt text or caption, and likes and comments on hover are also read on keyboard focus.
  • The popup is a modal dialog: it traps focus, closes on Escape, returns focus to the tile, and Left and Right arrows move between posts.
  • The slider is a focusable scroll region with scroll-snap, so it swipes on touch and scrolls with arrow keys; its buttons disable at each end.
  • Follow is a toggle button with `aria-pressed`, or a safe link to the profile when no handler is given; unsafe supplied post/profile targets never become active links.
  • The mobile sheet and backdrop enter together; tile entrance, hover zoom, like pop and double-tap heart are dropped under `prefers-reduced-motion`.