ComponentsSite blocks

Sidebar widgets

The sidebar of a news or magazine site and the grid it lives in. NewsColumns: main column + 20rem sidebar that stacks under the main column on narrow containers; its asideSticky tail (an ad, sections) sticks below the header once the rest has scrolled by. Widgets: FollowCounts (followers per network, compact and locale-formatted, one link per row), PopularPosts (numbered or thumbnails), RecentComments (who commented on which story), CategoryCounts (sections with story counts) and SidebarWidget for your own. Server components.

blocks/site/news-widgets.tsx, blocks/site/post-card.tsx, blocks/site/shared/brand-icons.tsx, styles/blocks.csstheme · material · accent · density · font

Installation

$ pnpm add @vamos-ui/react

The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";

Usage

import { NewsColumns, FollowCounts, PopularPosts, RecentComments, CategoryCounts, AdSlot } from "@vamos-ui/react/blocks";

<NewsColumns asideLabel="More from the Ledger"
  aside={<>
    <FollowCounts title="Stay connected" accounts={[{ network: "youtube", href, count: 22900, unit: "subscribers", action: "Subscribe" }]} />
    <PopularPosts title="Most read" posts={mostRead} />
    <RecentComments title="Recent comments" comments={comments} />
  </>}
  asideSticky={<><AdSlot size="rectangle" /><CategoryCounts title="Sections" categories={sections} /></>}>
  {modules}
</NewsColumns>

Examples

Columns with a sticky tail

A whole sidebar taller than the screen can't stick usefully; only asideSticky does. Offset: --news-sticky-offset (default 4.5rem, the section bar).

Latest

API

NewsColumns

PropTypeDefault
children / aside / asideSticky / asideLabel / asideStart
Main column, sidebar, sticky tail, sidebar name, sidebar on the start side.
ReactNode / string / boolean—

FollowCounts

PropTypeDefault
accounts
network: any BrandName (x, instagram, facebook, youtube, linkedin, tiktok…). Opens in a new tab (announced).
{ network; href; count; unit?; action? }[]—

PopularPosts

PropTypeDefault
posts / variant / limit
Ordered list; default 5 items.
NewsPost[] / "numbered" | "thumbs" / number—

RecentComments

PropTypeDefault
comments
href points at the comment anchor.
{ author; postTitle; postHref; href?; excerpt?; at? }[]—

CategoryCounts

PropTypeDefault
categories
Count is visible as a number and read as “271 stories”.
{ label; href; count }[]—

SidebarWidget

PropTypeDefault
title / href / headingLevel / children
Small-caps heading on a rule + any content.
…—