Features: alternating product stories
A series of feature stories alternating text and image placeholders.
pnpm dlx shadcn@latest add @haze/features-alternating---
import { cn } from "../../../lib/haze/utils";
import Placeholder from "../ui/placeholder.astro";
interface Props {
id?: string;
eyebrow?: string;
title?: string;
description?: string;
headingLevel?: 1 | 2 | 3;
features?: { label: string; title: string; description: string; visual: "app" | "chart" | "photo" }[];
class?: string;
}
const {
id = "features-alternating",
eyebrow = "How it helps",
title = "A little more clarity at every step",
description = "Keep the details close to the work, from the first idea to the final handoff.",
headingLevel = 2,
features = [
{ label: "01 / Plan", title: "Give ideas a place to grow", description: "Collect the context, owners and next steps for a project before work begins.", visual: "app" },
{ label: "02 / Follow through", title: "See progress without a meeting", description: "Keep the latest status alongside the work so updates are easy to find.", visual: "chart" },
{ label: "03 / Share", title: "Bring the right people in", description: "Give collaborators a shared view of decisions and the details behind them.", visual: "app" },
],
class: className,
} = Astro.props;
const Heading = ({ 1: "h1", 2: "h2", 3: "h3" } as const)[headingLevel];
const ItemHeading = ({ 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-14 grid gap-16 sm:gap-20">
{features.map((feature, index) => (
<div class="grid items-center gap-8 lg:grid-cols-2 lg:gap-16">
<div class={cn("max-w-md", index % 2 === 1 && "lg:order-2")}>
<p class="font-mono text-[0.6875rem]/4 font-medium tracking-wider text-muted-foreground uppercase">{feature.label}</p>
<ItemHeading class="mt-3 text-2xl/8 font-semibold tracking-tight text-foreground">{feature.title}</ItemHeading>
<p class="mt-4 text-base/7 text-pretty text-muted-foreground">{feature.description}</p>
</div>
<Placeholder variant={feature.visual} class="aspect-[4/3]" />
</div>
))}
</div>
</div>
</section>When to use
- Explaining a few features that each need their own visual context
- A sequential product story is more useful than a compact icon grid
When not to use
- Many short benefits need equal space; use features-icon-grid
Installation
Add the Haze registry to components.json once, then install Features: alternating product stories with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/features-alternatingnpx shadcn@latest add @haze/features-alternatingyarn dlx shadcn@latest add @haze/features-alternatingbunx --bun shadcn@latest add @haze/features-alternatingFirst 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 | "features-alternating" | Unique section ID prefix. |
| eyebrow | string | "How it helps" | Label above the introduction. |
| title | string | demo heading | Section heading. |
| description | string | demo copy | Introduction to the feature stories. |
| headingLevel | 1 | 2 | 3 | 2 | Section heading level; feature headings use the next level. |
| features | { label: string; title: string; description: string; visual: "app" | "chart" | "photo" }[] | 3 example stories | Stories and their decorative placeholder variants. |
| class | string | – | Additional classes on the section. |
Accessibility
- Feature headings follow the section heading in document order, even when the visual position alternates.
- Illustrative placeholders are decorative; each story is explained in text.
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 "Features: alternating product stories" with `npx shadcn@latest add @haze/features-alternating`. 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 FeaturesAlternating from "@/components/haze/blocks/features-alternating.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/features-alternating.md
Customize with real content
Adapt the Haze features-alternating block for our product. Replace the demo values of these props with our real content: id, eyebrow, title, description, headingLevel, features, class. Keep the layout, the heading level rules and these accessibility details: Feature headings follow the section heading in document order, even when the visual position alternates. Illustrative placeholders are decorative; each story is explained in text. Do not add raw color classes; use the Haze tokens.
Choose the right block
Before using features-alternating, check it fits: use it when explaining a few features that each need their own visual context; a sequential product story is more useful than a compact icon grid. Avoid it when many short benefits need equal space; use features-icon-grid. Alternatives: @haze/features-icon-grid.
Dependencies
- @haze/placeholder
- @haze/utils
- @haze/theme (one-time setup)
Source · Original Haze UI work.