Bento: four tiles with one hero tile
Asymmetric four-tile grid; the first tile spans two columns and rows, and each tile is a flat panel with a visual on top and copy below.
pnpm dlx shadcn@latest add @haze/bento-grid---
import { cn } from "../../../lib/haze/utils";
import Placeholder from "../ui/placeholder.astro";
interface Props {
title?: string;
description?: string;
items?: { title: string; description: string; visual: "app" | "chart" | "photo" }[];
}
const {
title = "One workspace for the whole product cycle",
description = "From the first idea to the release note, every step lives in the same place.",
items = [
{ title: "Roadmaps that stay current", description: "Projects roll up into initiatives, and progress updates itself from the work underneath.", visual: "app" },
{ title: "Cycle analytics", description: "Spot scope creep before it ships late.", visual: "chart" },
{ title: "Triage inbox", description: "Route incoming bugs and requests in seconds.", visual: "photo" },
{ title: "Release notes in one click", description: "Turn merged work into a changelog your customers will actually read.", visual: "chart" },
],
} = Astro.props;
// Four columns from lg: the first tile is 2x2, the last is wide. At md (two columns) the first and last tiles span both columns, so every row is full.
const spans = ["md:col-span-2 lg:row-span-2", "", "", "md:col-span-2"];
---
<section aria-labelledby="bento-grid-title" class="bg-background px-6 py-20 sm:py-24">
<div class="mx-auto max-w-6xl">
<h2 id="bento-grid-title" class="max-w-2xl text-3xl/9 font-semibold tracking-tight text-balance text-foreground sm:text-4xl/11">{title}</h2>
<p class="mt-4 max-w-2xl text-base/7 text-pretty text-muted-foreground">{description}</p>
<ul class="mt-12 grid auto-rows-fr gap-4 md:grid-cols-2 lg:grid-cols-4">
{
items.map((item, i) => (
<li class={cn("flex flex-col overflow-hidden rounded-2xl border border-border bg-card", spans[i % spans.length])}>
<Placeholder variant={item.visual} class="min-h-48 flex-1 rounded-none border-0 border-b border-border" />
<div class="p-6">
<h3 class="text-[0.9375rem]/6 font-semibold tracking-tight text-card-foreground">{item.title}</h3>
<p class="mt-2 text-sm/6 text-muted-foreground">{item.description}</p>
</div>
</li>
))
}
</ul>
</div>
</section>When to use
- Showcasing three to five features where one is clearly the headline
- Feature visuals matter more than the copy
When not to use
- You have more than five features of equal weight; use features-icon-grid
Installation
Add the Haze registry to components.json once, then install Bento: four tiles with one hero tile with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/bento-gridnpx shadcn@latest add @haze/bento-gridyarn dlx shadcn@latest add @haze/bento-gridbunx --bun shadcn@latest add @haze/bento-gridFirst 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 |
|---|---|---|---|
| title | string | demo heading | Section heading (h2). |
| description | string | demo copy | Intro paragraph. |
| items | { title: string; description: string; visual: "app" | "chart" | "photo" }[] | 4 demo tiles | Tiles in order; the span pattern repeats every four. Tiles do not move on hover because they are not links. |
Accessibility
- Tiles are list items with h3 headings, so reading order matches the visual order on every breakpoint.
- Visuals are decorative placeholders; give real images alt text when you replace them.
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 "Bento: four tiles with one hero tile" with `npx shadcn@latest add @haze/bento-grid`. 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 BentoGrid from "@/components/haze/blocks/bento-grid.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/bento-grid.md
Customize with real content
Adapt the Haze bento-grid block for our product. Replace the demo values of these props with our real content: title, description, items. Keep the layout, the heading level rules and these accessibility details: Tiles are list items with h3 headings, so reading order matches the visual order on every breakpoint. Visuals are decorative placeholders; give real images alt text when you replace them. Do not add raw color classes; use the Haze tokens.
Choose the right block
Before using bento-grid, check it fits: use it when showcasing three to five features where one is clearly the headline; feature visuals matter more than the copy. Avoid it when you have more than five features of equal weight; use features-icon-grid. Alternatives: @haze/features-icon-grid.
Dependencies
- @haze/placeholder
- @haze/utils
- @haze/theme (one-time setup)
Source · Original Haze UI work.