# Bento tile

> A feature tile with an optional edge-to-edge visual, a caption, and room for controls or supporting content.

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

## Use when
- You need a shared panel treatment across a product mosaic.
- One panel should receive a restrained brand tint.

## Avoid when
- The whole surface needs to be a single link.

## Alternatives
- [card](https://hazeui.com/ui/card.md)
- [bento-mosaic](https://hazeui.com/ui/bento-mosaic.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| title | `string` |  | yes | Visible panel heading. |
| description | `string` |  | no | Supporting text below the title. |
| headingLevel | `2 \| 3 \| 4` | 3 | no | Heading level in the surrounding document. |
| span | `quarter \| third \| half \| two-thirds \| three-quarters \| full` | third | no | Column span inside Bento Mosaic. Full spans both columns at intermediate widths. |
| variant | `default \| info` | default | no | Neutral surface, or a raised neutral surface with a stronger border for emphasis. |
| default slot | `slot` |  | no | Content or controls in the panel body. |
| visual slot | `slot` |  | no | Artwork or a working product sample above the caption. Give meaningful diagrams a text equivalent. |
| accessory slot | `slot` |  | no | Compact header detail such as a status. |
| class | `string` |  | no | Classes on the article. |
| bodyClass | `string` |  | no | Classes on the body grid. |
| visualClass | `string` |  | no | Sizing, alignment and surface classes for the visual slot. |

## Accessibility
- Pick a heading level that matches the outline.
- Controls keep their native focus order. Hide decorative artwork from assistive technology.

## Agent prompts

### Install and use

Install the Haze UI component "Bento tile" with `npx shadcn@latest add @haze/bento-tile`. 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 BentoTile from "@/components/haze/ui/bento-tile.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-tile.md

### Customize with real content

Adapt the Haze bento-tile ui for our product. Replace the demo values of these props with our real content: title, description, headingLevel, span, variant, default slot, visual slot, accessory slot, class, bodyClass, visualClass. Keep the layout, the heading level rules and these accessibility details: Pick a heading level that matches the outline. Controls keep their native focus order. Hide decorative artwork from assistive technology. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using bento-tile, check it fits: use it when you need a shared panel treatment across a product mosaic.; one panel should receive a restrained brand tint.. Avoid it when the whole surface needs to be a single link.. Alternatives: @haze/card, @haze/bento-mosaic.

## Example requests that should lead here
- Create an emphasized tile with a preview environment status and the build identifier.

## Source

```astro
---
import { cn } from "../../../lib/haze/utils";

interface Props {
  title: string;
  description?: string;
  headingLevel?: 2 | 3 | 4;
  span?: "quarter" | "third" | "half" | "two-thirds" | "three-quarters" | "full";
  variant?: "default" | "info";
  class?: string;
  bodyClass?: string;
  visualClass?: string;
}

const { title, description, headingLevel = 3, span = "third", variant = "default", class: className, bodyClass, visualClass } = Astro.props;
const Heading = ({ 2: "h2", 3: "h3", 4: "h4" } as const)[headingLevel];
const hasVisual = Astro.slots.has("visual");
const spans = {
  quarter: "@2xl/bento:col-span-3",
  third: "@2xl/bento:col-span-4",
  half: "@2xl/bento:col-span-6",
  "two-thirds": "@2xl/bento:col-span-8",
  "three-quarters": "@2xl/bento:col-span-9",
  full: "@md/bento:col-span-full",
};
---

<article class={cn(
  "group/tile flex min-w-0 flex-col rounded-2xl border border-border bg-card text-card-foreground",
  !hasVisual && "gap-4 p-4 sm:p-5",
  variant === "info" && "border-border-strong bg-muted",
  spans[span],
  className,
)}>
  {hasVisual && (
    <div class={cn("relative isolate grid min-h-40 min-w-0 flex-1 overflow-clip rounded-t-2xl border-b border-border bg-muted", visualClass)}>
      <slot name="visual" />
    </div>
  )}
  <div class={hasVisual ? "flex min-w-0 flex-col gap-3 p-4 sm:p-5 lg:p-6" : "contents"}>
    <div class="flex min-w-0 flex-wrap items-start justify-between gap-x-2 gap-y-0.5">
      <div class="min-w-0 grow basis-36">
        <Heading class={cn("font-medium tracking-tight wrap-anywhere", hasVisual ? "text-lg/6 sm:text-xl/7" : "text-[1.0625rem]/6")}>{title}</Heading>
        {description && <p class="mt-1 max-w-prose text-pretty wrap-anywhere text-[0.8125rem]/5 text-muted-foreground">{description}</p>}
      </div>
      <slot name="accessory" />
    </div>
    {Astro.slots.has("default") && <div class={cn("grid min-w-0 content-start gap-3", bodyClass)}><slot /></div>}
  </div>
</article>
```
