Blog: featured story and recent posts
A featured article with an image placeholder, alongside a compact list of recent stories.
pnpm dlx shadcn@latest add @haze/blog-featured-stories---
import { ArrowUpRight } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";
import Placeholder from "../ui/placeholder.astro";
interface Story { title: string; excerpt: string; category: string; date: string; dateLabel: string; href?: string }
interface Props {
id?: string;
eyebrow?: string;
title?: string;
description?: string;
headingLevel?: 1 | 2 | 3;
featured?: Story;
stories?: Story[];
class?: string;
}
const {
id = "blog-featured-stories",
eyebrow = "From the journal",
title = "Ideas for better work",
description = "Practical notes on building thoughtful products and the teams behind them.",
headingLevel = 2,
featured = { title: "A calmer way to plan the week", excerpt: "A few small changes can give your team more time to focus and fewer reasons to check in.", category: "Teamwork", date: "2026-11-05", dateLabel: "November 5, 2026" },
stories = [
{ title: "Make project updates worth reading", excerpt: "Share the context that helps people make decisions.", category: "Practice", date: "2026-10-22", dateLabel: "October 22, 2026" },
{ title: "The case for smaller handoffs", excerpt: "Keep momentum without losing the details.", category: "Product", date: "2026-10-09", dateLabel: "October 9, 2026" },
{ title: "A useful first draft of a roadmap", excerpt: "Start with outcomes, then make room for what you learn.", category: "Planning", date: "2026-09-24", dateLabel: "September 24, 2026" },
],
class: className,
} = Astro.props;
const Heading = ({ 1: "h1", 2: "h2", 3: "h3" } as const)[headingLevel];
const StoryHeading = ({ 1: "h2", 2: "h3", 3: "h4" } as const)[headingLevel];
---
<section aria-labelledby={`${id}-title`} class={cn("bg-background px-6 py-20 sm:py-24", className)}>
<div class="mx-auto max-w-6xl">
<div class="max-w-2xl">
<p class="text-[0.6875rem]/4 font-medium tracking-wider text-muted-foreground uppercase">{eyebrow}</p>
<Heading id={`${id}-title`} class="mt-3 text-3xl/9 font-semibold tracking-tight text-balance text-foreground sm:text-4xl/11">{title}</Heading>
<p class="mt-4 text-base/7 text-pretty text-muted-foreground">{description}</p>
</div>
<div class="mt-12 grid gap-8 lg:grid-cols-2 lg:gap-12">
<article class="overflow-hidden rounded-xl border border-border bg-card">
<Placeholder variant="app" class="h-48 rounded-none border-0 border-b border-border sm:h-56" />
<div class="p-6 sm:p-8">
<p class="text-[0.8125rem]/5 text-muted-foreground"><span class="font-medium text-foreground">{featured.category}</span><span aria-hidden="true"> · </span><time datetime={featured.date}>{featured.dateLabel}</time></p>
<StoryHeading class="mt-3 text-xl/7 font-semibold tracking-tight text-foreground">
{featured.href ? <a href={featured.href} class="rounded-sm underline-offset-4 hover:underline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring">{featured.title}<ArrowUpRight aria-hidden="true" class="ml-1 inline size-4" /></a> : featured.title}
</StoryHeading>
<p class="mt-3 text-sm/6 text-muted-foreground">{featured.excerpt}</p>
</div>
</article>
<div class="divide-y divide-border border-y border-border">
{stories.map((story) => (
<article class="py-6 first:pt-6 last:pb-6">
<p class="text-[0.8125rem]/5 text-muted-foreground"><span class="font-medium text-foreground">{story.category}</span><span aria-hidden="true"> · </span><time datetime={story.date}>{story.dateLabel}</time></p>
<StoryHeading class="mt-2 text-base/6 font-semibold tracking-tight text-foreground">
{story.href ? <a href={story.href} class="rounded-sm underline-offset-4 hover:underline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring">{story.title}<ArrowUpRight aria-hidden="true" class="ml-1 inline size-4" /></a> : story.title}
</StoryHeading>
<p class="mt-2 text-sm/6 text-muted-foreground">{story.excerpt}</p>
</article>
))}
</div>
</div>
</div>
</section>When to use
- Highlighting one article while keeping recent writing visible
- A journal landing page needs dates, categories and summaries
When not to use
- Every item should have the same visual weight in a feature overview; use features-icon-grid
Installation
Add the Haze registry to components.json once, then install Blog: featured story and recent posts with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/blog-featured-storiesnpx shadcn@latest add @haze/blog-featured-storiesyarn dlx shadcn@latest add @haze/blog-featured-storiesbunx --bun shadcn@latest add @haze/blog-featured-storiesFirst time? Registry and theme setup
1. Add to components.json:
{
"registries": {
"@haze": "http://localhost:4329/r/{name}.json"
}
}2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | "blog-featured-stories" | Section ID prefix; use a unique prefix for each instance. |
| eyebrow | string | "From the journal" | Label above the heading. |
| title | string | demo heading | Title of the editorial section. |
| description | string | demo copy | Introductory text for the collection. |
| headingLevel | 1 | 2 | 3 | 2 | Level of the section heading; article headings follow it. |
| featured | { title: string; excerpt: string; category: string; date: string; dateLabel: string; href?: string } | demo featured article | Featured story. Add href to make its title a link. |
| stories | { title: string; excerpt: string; category: string; date: string; dateLabel: string; href?: string }[] | 3 demo stories | Recent stories; dates should use ISO format. |
| class | string | – | Additional classes on the section. |
Keyboard interactions
- Tab
- Reach each story title that has a URL.
Accessibility
- Stories use article elements with machine-readable dates and descriptive optional links.
- The featured artwork is a decorative color placeholder; replace it with an appropriate visual when needed.
Notes for AI
Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.
Install and use
Install the Haze UI block "Blog: featured story and recent posts" with `npx shadcn@latest add @haze/blog-featured-stories`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import BlogFeaturedStories from "@/components/haze/blocks/blog-featured-stories.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/blog-featured-stories.md
Customize with real content
Adapt the Haze blog-featured-stories block for our product. Replace the demo values of these props with our real content: id, eyebrow, title, description, headingLevel, featured, stories, class. Keep the layout, the heading level rules and these accessibility details: Stories use article elements with machine-readable dates and descriptive optional links. The featured artwork is a decorative color placeholder; replace it with an appropriate visual when needed. Do not add raw color classes; use the Haze tokens.
Choose the right block
Before using blog-featured-stories, check it fits: use it when highlighting one article while keeping recent writing visible; a journal landing page needs dates, categories and summaries. Avoid it when every item should have the same visual weight in a feature overview; use features-icon-grid. Alternatives: @haze/features-icon-grid.
Dependencies
- npm: @lucide/astro
- @haze/placeholder
- @haze/utils
- @haze/theme (one-time setup)
Source · Original Haze UI work.