Skip to content
Sign in
Apps SDKNews stackMenu

News stackPro

Headlines as a stack with one story open at a time: its summary, picture and every outlet that ran it. The rest stay a line or two with their source and age.

ProThe week's tableware and café trade news: one story open with its summary and every outlet that ran it.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/news-stack

Usage

tsx
import { NewsStack } from "@/components/ui/chatcn/pro/news-stack"

<NewsStack
  title="Tableware and café trade"
  items={stories}
  newSince={lastVisit}
  updatedAt="09:12"
  onRead={(story) => window.open(story.url)}
/>

Stories sort newest first and the first one opens. Opening another closes it, so the stack stays a scannable list. Stories published after newSince carry a small New mark. Past visibleItems the stack folds behind a count.

Examples

Folded, long headlines, loading, empty and error

ProAll closed and folded, a long headline from many outlets, loading, no stories and an error.

Props

PropTypeNotes
itemsNewsItem[]{ id, title, source, publishedAt, summary?, image?, url?, kind?, alsoFrom? }
title, updatedAtHeader
nowDateReference for relative times
newSincestring | number | DateMarks newer stories
open, defaultOpen, onOpenChangestring | nullThe open story
onRead(item) => voidRead at the source
visibleItemsnumberBefore the fold. Default 4
status, onRetry"ready" | "loading" | "error"
onExpand() => voidFull screen button in the header
locale, labels

Keyboard

KeyAction
ArrowDown, ArrowUpNext or previous headline
Home, EndFirst or last headline
Enter, SpaceOpen or close the story

Accessibility

  • Each headline is a heading with a disclosure button that controls its story region.
  • Times are time elements with the full date. The New mark is a word, not only a dot.

Motion

  • The open story rises 4 px into place in 220 ms and the chevron turns. Reduced motion: no movement.