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

RSS Feed

ProNew

A news feed with a header and Subscribe link, showing stories with thumbnail, source, title, excerpt and time as a list, a card grid or a one-line ticker.

Installation

pnpm dlx shadcn@latest add @viewport/rss-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
items*RssItem[]—
layout"list" | "cards" | "masonry" | "carousel" | "ticker"

`list` stacks rows with a thumbnail, `cards` wraps into columns, `masonry` packs the same cards into columns, `carousel` slides them sideways with arrows and dots, `ticker` scrolls headlines in one line.

"list"
titlestring

Name of the feed, shown in the header and on the ticker's badge.

"Latest stories"
descriptionstring—
feedHrefstring

Address of the feed itself. Adds a Subscribe link to the header.

—
pageSizenumber

Items shown before "Load more" in the list and cards layouts.

6
linesnumber

Lines of excerpt before it is cut.

3
loadingboolean

Shows placeholders while you fetch the feed.

—
errorstring

An error message to show instead of the items.

—
onRetry() => void

Called by the Retry button next to the error, which is hidden without it.

—
durationnumber

Seconds the ticker takes for one full loop. Defaults to six seconds per headline.

—
newTabboolean

Opens stories in a new tab.

true
classNamestring—

Accessibility

  • Each story is an `article` whose title is the link; the whole row or card is clickable but is read once, by its headline.
  • The ticker pauses on hover and on keyboard focus, has a Pause button, and its repeated copy is hidden from assistive tech and the tab order.
  • Under `prefers-reduced-motion` the ticker stops and becomes a strip you scroll yourself; entrance and hover motion are dropped.
  • Loading shows placeholders and announces "Loading stories"; an error is announced as an alert with a Retry button.
  • Works with no thumbnails or source logos: the publication's initial stands in.