# Bento mosaic

> A container-responsive grid for combining tiles of different widths without changing their reading order.

- Kind: ui · Category: Layout and media · Interactivity: none
- Install: `npx shadcn@latest add @haze/bento-mosaic`
- File: `src/components/haze/ui/bento-mosaic.astro`
- npm dependencies: none
- Registry dependencies: @haze/utils
- Docs page: https://hazeui.com/ui/bento-mosaic

## Use when
- You are composing a product showcase from small and large cards.
- The same group needs to fit a narrow panel and a full-width section.

## Avoid when
- A uniform gallery needs identical card sizes at every width.

## Alternatives
- [bento-grid](https://hazeui.com/blocks/bento-grid.md)
- [bento-tile](https://hazeui.com/ui/bento-tile.md)
- [features-icon-grid](https://hazeui.com/blocks/features-icon-grid.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| default slot | `slot` |  | yes | Bento tiles or other children. Give each child a desktop column span. |
| class | `string` |  | no | Classes on the outer width container. |
| gridClass | `string` |  | no | Classes on the inner grid for placement or gap overrides. |

## Accessibility
- Put children in reading order before assigning spans.
- Container queries stack tiles in narrow slots independent of the viewport width.

## Agent prompts

### Install and use

Install the Haze UI component "Bento mosaic" with `npx shadcn@latest add @haze/bento-mosaic`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/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 BentoMosaic from "@/components/haze/ui/bento-mosaic.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: https://hazeui.com/ui/bento-mosaic.md

### Customize with real content

Adapt the Haze bento-mosaic ui for our product. Replace the demo values of these props with our real content: default slot, class, gridClass. Keep the layout, the heading level rules and these accessibility details: Put children in reading order before assigning spans. Container queries stack tiles in narrow slots independent of the viewport width. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using bento-mosaic, check it fits: use it when you are composing a product showcase from small and large cards.; the same group needs to fit a narrow panel and a full-width section.. Avoid it when a uniform gallery needs identical card sizes at every width.. Alternatives: @haze/bento-grid, @haze/bento-tile, @haze/features-icon-grid.

## Example requests that should lead here
- Build a dashboard mosaic with a wide activity card, a smaller queue card and a full-width handoff.

## Source

```astro
---
import { cn } from "../../../lib/haze/utils";

interface Props {
  class?: string;
  gridClass?: string;
}

const { class: className, gridClass } = Astro.props;
---

<div class={cn("@container/bento min-w-0", className)}>
  <div data-bento-grid class={cn("grid min-w-0 grid-cols-1 gap-3 @md/bento:grid-cols-2 @2xl/bento:grid-cols-12 @2xl/bento:gap-4", gridClass)}>
    <slot />
  </div>
</div>
```
