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

Blog

ProNew

A supplied-post blog index with a featured article, category filters and grid, list or masonry cards in plain or image-overlay style, plus an inline or popup post reader.

Installation

pnpm dlx shadcn@latest add @viewport/blog

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*BlogPost[]—
layout"grid" | "list" | "masonry"

`grid` wraps equal cards into columns, `list` stacks rows with a thumbnail, `masonry` packs covers of mixed heights.

"grid"
variant"card" | "overlay"

`card` puts the text under the cover; `overlay` prints it over the cover on a dark gradient.

"card"
featuredboolean

Shows the first post large, above the rest.

true
titlestring

Heading above the posts.

—
descriptionstring—
categoriesboolean

Shows a filter pill per category. Needs at least two categories.

true
aspect"square" | "landscape" | "portrait"

Shape of the covers in the grid and list layouts.

"square"
pageSizenumber

Posts shown before "Load more".

6
reader"popup" | "inline"

`popup` opens a post in a dialog; `inline` replaces the list with the post and a back button.

"popup"
loadingboolean

Shows placeholders while you fetch the posts.

—
onOpen(post: BlogPost) => void

Called when a post is opened in the reader.

—
classNamestring—

Accessibility

  • Each post is an `article` whose title is the one control; the whole card is clickable but is announced once, by its headline.
  • The popup reader is a modal dialog titled by the post: it traps focus, closes on Escape and returns focus to the card that opened it; backdrop and panel enter together.
  • The inline reader moves focus to the post's heading, and the back button returns it to the card you came from.
  • Category filters are toggle buttons with `aria-pressed`; loading announces "Loading posts" while placeholders show.
  • Entrance, cover zoom, the sliding filter pill and the dialog animation are dropped under `prefers-reduced-motion`.