Data displayBentoTile
Searchastronomic.dev# BentoTile
For one tile in a Bento section: its size, an icon, title and text, a dark or accent fill, a photo above, beside or behind the text, any visual you add, and a link or button. The bento recipes use it for you.
Static: no JavaScript.
## Usage
```astro
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
```
## Examples
### In a Bento grid
Seven tiles that fill a four-column Bento grid with no gaps: a large highlighted tile, a tall one with an image that fills its free height, normal ones with and without text, and a wide one. The bento recipes build their tiles from it, so you only need it for your own layout.
```astro
---
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
// Your own image file.
import desk from "../../photos/studio-desk.webp";
const heading = "Tiles";
const tag = childHeadingTag({ heading });
---
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass="gap-cards @lg/bento:grid-cols-2 @lg/bento:grid-flow-row-dense @lg/bento:auto-rows-bento @3xl/bento:grid-cols-4">
<BentoTile title="A large, highlighted tile" text="Two by two from 48rem, in the soft accent fill, its title in the subhead role." size="large" highlighted headingTag={tag} />
<BentoTile title="A tall tile" text="Its image fills the free height." size="tall" image={{ src: desk, alt: "A laptop, a framed print and a cactus on a light wood desk." }} headingTag={tag} />
<BentoTile title="A normal tile, title only" headingTag={tag} />
<BentoTile title="A normal tile, with text" text="One cell: its title and a line under it." headingTag={tag} />
<BentoTile title="A wide tile" text="Two cells across." size="wide" headingTag={tag} />
<BentoTile title="Rows of one height" text="Each row is at least the bento row height." headingTag={tag} />
<BentoTile title="No gaps" text="Small tiles fill the holes big ones leave." headingTag={tag} />
</Bento>
</div>
```
### With an icon
Four tiles, each with a Lucide icon above the title: in the accent color on the surface and highlighted tiles, in the inverse mark color on the inverse one. The icon is decorative; the title says what it means.
```astro
---
import Accessibility from "@lucide/astro/icons/accessibility";
import Gauge from "@lucide/astro/icons/gauge";
import Layers from "@lucide/astro/icons/layers";
import Palette from "@lucide/astro/icons/palette";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
const heading = "What every theme starts with";
const tag = childHeadingTag({ heading });
---
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass="gap-cards @lg/bento:grid-cols-2 @lg/bento:grid-flow-row-dense @lg/bento:auto-rows-bento @3xl/bento:grid-cols-4">
<BentoTile title="One kit" text="Every Astronomic theme is built from the same parts." icon={Layers} highlighted headingTag={tag} />
<BentoTile title="Presets" text="Fonts, colors and corners change in one place." icon={Palette} headingTag={tag} />
<BentoTile title="Fast pages" text="Small pages with little JavaScript, quick on any phone." icon={Gauge} headingTag={tag} />
<BentoTile title="Built for access" text="Real headings, visible focus and text that reads in light and dark." icon={Accessibility} tone="inverse" headingTag={tag} />
</Bento>
</div>
```
### The whole tile as a link
Three tiles with href and a viewText cue ("Read the docs", "See the themes", "Get the pass"): a click anywhere on the tile follows the link, and the tile is one tab stop named by its title. The fourth is not a link and holds a Button in its action slot. The grid is not dense, so the tab order stays in the visual order.
```astro
---
import Button from "@astronomic-dev/ui/components/Button.astro";
import BookOpen from "@lucide/astro/icons/book-open";
import LayoutGrid from "@lucide/astro/icons/layout-grid";
import Ticket from "@lucide/astro/icons/ticket";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
const heading = "Start here";
const tag = childHeadingTag({ heading });
---
<!-- A linked tile is one link: click anywhere on it, or Tab to it once. The grid is not dense, so the tab order stays in the visual order. -->
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass="gap-cards @lg/bento:grid-cols-2 @lg/bento:auto-rows-bento @3xl/bento:grid-cols-4">
<BentoTile title="Astronomic UI" text="Every part's props, slots and examples, with notes on access." icon={BookOpen} href="/ui" viewText="Read the docs" headingTag={tag} />
<BentoTile title="Themes for real businesses" text="Studios, newsletters, trades and real estate, all on the same kit." icon={LayoutGrid} href="/themes" viewText="See the themes" headingTag={tag} />
<BentoTile title="The Themes Pass" text="Every Astronomic theme, unlimited sites and lifetime updates." icon={Ticket} href="/pricing" viewText="Get the pass" tone="inverse" headingTag={tag} />
<BentoTile title="Guides for your site" text="Plain guides on Astro, EmDash and moving from WordPress." headingTag={tag}>
<Button slot="action" variant="secondary" size="sm" href="/learn">Read the guides</Button>
</BentoTile>
</Bento>
</div>
```
### Text on a photo
mediaPlacement="behind": the photo fills the tile and the text sits at its foot on a scrim that reads on any image. The large tile is one link with a viewText cue; the tall one has a Button with tone="image" in its action slot, on the same scrim.
```astro
---
import Button from "@astronomic-dev/ui/components/Button.astro";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
import { bentoGridSparse } from "@astronomic/ui-pro/lib/bento.ts";
// Your own image files.
import slab from "../../photos/concrete-slab.webp";
import stairway from "../../photos/white-stairway.webp";
const heading = "Text on a photo";
const tag = childHeadingTag({ heading });
---
<!-- The text sits on a scrim that reads on any photo. The large tile is one link; the tall one has a Button (tone="image") on the same scrim. -->
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass={bentoGridSparse}>
<BentoTile
title="Apogee, for studios"
text="Big type, case studies and a quiet grid for the work."
size="large"
mediaPlacement="behind"
image={{ src: stairway, alt: "A white stairwell seen from above." }}
href="/themes/apogee"
viewText="See Apogee"
headingTag={tag}
/>
<BentoTile title="Groundcrew, for trades" text="Quotes, service areas and before and after photos." size="tall" mediaPlacement="behind" image={{ src: slab, alt: "A concrete building against the sky." }} headingTag={tag}>
<Button slot="action" tone="image" size="sm" href="/themes/groundcrew">See Groundcrew</Button>
</BentoTile>
<BentoTile title="Behind needs an image" text="Not a media slot, a tone or highlighted: the photo is the surface." headingTag={tag} />
<BentoTile title="On any photo" text="The scrim reads on black or white, in every preset, light and dark." headingTag={tag} />
</Bento>
</div>
```
### Inverse and highlighted
The three fills side by side: the surface, highlighted (the soft accent fill) and tone="inverse" (dark on a light page, light on a dark page). The inverse tile holds a Button with tone="inverse" in its action slot.
```astro
---
import Button from "@astronomic-dev/ui/components/Button.astro";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
import { bentoGridSparse } from "@astronomic/ui-pro/lib/bento.ts";
const heading = "Three fills";
const tag = childHeadingTag({ heading });
---
<!-- One fill per tile. On the inverse tile, give a Button tone="inverse". -->
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass={bentoGridSparse}>
<BentoTile title="Surface" text="The card, as every tile starts." headingTag={tag} />
<BentoTile title="Highlighted" text="The soft accent fill, for the tile to point at." highlighted headingTag={tag} />
<BentoTile title="Lifetime updates" text="Buy a theme once and get every update to it, on unlimited sites." size="wide" tone="inverse" headingTag={tag}>
<Button slot="action" tone="inverse" size="sm" href="/pricing">See pricing</Button>
</BentoTile>
</Bento>
</div>
```
### Image beside the text
mediaPlacement="start" and "end": the image goes beside the text once the tile is 28rem wide, two parts to the text's three. The large tile puts it at the end, the wide one at the start. The tall tile is one cell wide, so its start image stacks above the text; narrower, every tile stacks, and end puts the image under the text.
```astro
---
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
// Your own image files.
import shelves from "../../photos/studio-shelves.webp";
import notebook from "../../photos/leather-notebook.webp";
import desk from "../../photos/studio-desk.webp";
const heading = "Image beside the text";
const tag = childHeadingTag({ heading });
---
<!-- start and end go beside the text once the tile is 28rem wide; narrower they stack, start above the text, end below it. -->
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass="gap-cards @lg/bento:grid-cols-2 @lg/bento:grid-flow-row-dense @lg/bento:auto-rows-bento @3xl/bento:grid-cols-4">
<BentoTile
title="Pages your editors can run"
text="Every theme works in plain Astro, with EmDash supported for a full editor. The image sits at the end, after the text."
size="large"
mediaPlacement="end"
image={{ src: notebook, alt: "A tan leather notebook, a pen and a clip on pale gray paper." }}
headingTag={tag}
/>
<BentoTile title="Made for the work" text="The image sits at the start." size="wide" mediaPlacement="start" image={{ src: shelves, alt: "Plates and bowls on white shelves." }} headingTag={tag} />
<BentoTile title="Stacked when narrow" text="A tall tile is one cell wide, so its start image sits above the text." size="tall" mediaPlacement="start" image={{ src: desk, alt: "A laptop, a framed print and a cactus on a light wood desk." }} headingTag={tag} />
<BentoTile title="By the tile's width" text="Not the page's: any size can go beside." headingTag={tag} />
<BentoTile title="Two parts to three" text="The image takes two parts of the row and the text three, the text centered beside it." size="wide" headingTag={tag} />
<BentoTile title="Same order" text="End puts the text first in the page too." headingTag={tag} />
</Bento>
</div>
```
### Your own visual
The media slot holds any visual: a stat, a type-scale chart, a row of theme names, a quote, a code snippet and preset swatches. It has no inset, so text and numbers keep the card padding. Keep headings out of it: a stat is a <p>, a quote a <figure>; mark a picture that only decorates aria-hidden.
```astro
---
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
import Star from "../../logos/astronomic-star.svg";
const heading = "Your own visual";
const tag = childHeadingTag({ heading });
// The kit's type roles, largest first, drawn as bars (decorative: the tile's title says what it is).
const scale = [
{ role: "display", width: "100%" },
{ role: "title", width: "80%" },
{ role: "section", width: "64%" },
{ role: "subhead", width: "50%" },
{ role: "heading", width: "38%" },
{ role: "body", width: "26%" },
];
const themes = ["Agency", "Dispatch", "Lodestar", "Vesper", "Apogee", "Vega", "Groundcrew"];
const swatches = ["bg-accent", "bg-accent-soft", "bg-fg", "bg-muted", "bg-surface"];
---
<!-- The media slot takes any visual with no headings: a stat is a <p>, a quote a <figure>. Text-only visuals keep the card padding. -->
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass="gap-cards @lg/bento:grid-cols-2 @lg/bento:grid-flow-row-dense @lg/bento:auto-rows-bento @3xl/bento:grid-cols-4">
<BentoTile title="Sites per license" headingTag={tag}>
<p slot="media" class="m-0 display-face text-section leading-none text-accent">Unlimited</p>
</BentoTile>
<BentoTile title="Seven themes, one kit" text="Each one built on Astronomic UI." size="wide" headingTag={tag}>
<div slot="media" class="flex flex-wrap items-center gap-x-5 gap-y-2">
<Star class="size-6 shrink-0" aria-hidden="true" />
{themes.map((name) => <span class="heading-face text-body font-semibold">{name}</span>)}
</div>
</BentoTile>
<BentoTile title="A type scale" text="Six roles, display to body." headingTag={tag}>
<div slot="media" aria-hidden="true" class="grid gap-1.5 text-accent">
{
scale.map((step) => (
<div class="grid grid-cols-[4.5rem_1fr] items-center gap-2">
<span class="text-small text-muted">{step.role}</span>
<span class="h-2 rounded-full bg-current" style={`width: ${step.width}`} />
</div>
))
}
</div>
</BentoTile>
<BentoTile title="One import" text="Each part is one Astro file." size="wide" headingTag={tag}>
<pre slot="media" class="m-0 rounded-md bg-inverse p-4 text-small whitespace-pre-wrap text-on-inverse [overflow-wrap:anywhere]"><code>import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";</code></pre>
</BentoTile>
<BentoTile title="From the design principles" headingTag={tag}>
<figure slot="media" class="m-0 grid gap-2">
<blockquote class="m-0 heading-face text-heading text-balance">“Size to the box, not the page.”</blockquote>
<figcaption class="text-small text-muted">Astronomic UI design principles</figcaption>
</figure>
</BentoTile>
<BentoTile title="Presets change the look" headingTag={tag}>
<div slot="media" aria-hidden="true" class="flex flex-wrap gap-2">
{swatches.map((fill) => <span class={`size-8 rounded-full border border-border ${fill}`} />)}
</div>
</BentoTile>
</Bento>
</div>
```
## Props
### BentoTile
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | None | Required. The tile title, in the heading role in display type; in the subhead role on a large tile (one step under the section heading's title role), sized to the tile. With href, it is the link's name. |
| `text` | `string` | None | A sentence or two under the title, in the body role, muted (the page's text color when highlighted). Optional: a stat or logo tile may need only its title; without it there is no empty paragraph. |
| `size` | `"normal" \| "wide" \| "tall" \| "large"` | `"normal"` | The tile's cells from a 32rem bento container: "normal" one, "wide" two across, "tall" two down, "large" two across and, from 48rem, two down. Without an image or a media slot, a large tile's text sits at its foot. |
| `highlighted` | `boolean` | `false` | The tile to point at: the soft accent fill, its text in the page's text color. Not with tone="inverse" (one fill per tile; the build stops). |
| `tone` | `"surface" \| "inverse"` | `"surface"` | The tile's fill. "surface" is the card; "inverse" is the kit's inverse surface (dark on a light page, light on a dark page), as Panel's tone, with its own text, edge, icon and focus colors. The <li> carries data-tone, so your own slot content can follow it (group-data-[tone=inverse]:…). On an inverse tile, give a Button in the action slot tone="inverse". |
| `icon` | `IconComponent` | None | An icon above the title: Lucide's (@lucide/astro), your own SVG component, or another. Large and decorative (hidden from a screen reader, the title says what it means), in the accent color; the inverse mark color on an inverse tile. |
| `image` | `Omit<MediaImage, "ratio">` | None | An image, placed by mediaPlacement: { src, alt, width?, height?, focalPoint?, loading? } (Media). Stacked, in a wide, tall or large tile it fills the free height, cropped to cover; in a normal tile it keeps 16/9, so the normal tiles set the row height. Beside the text it fills its column. On a linked tile it grows slightly on hover and focus, only where motion is allowed. alt is required. The media slot wins over it. |
| `mediaPlacement` | `"above" \| "start" \| "end" \| "behind"` | `"above"` | Where the image or the media slot sits. "above": over the text at every width. "start" and "end": beside the text, on that side, once the tile is 28rem wide (2 parts media to 3 text, the text centered); narrower they stack, start above the text and end below it, so the reading order matches what shows. "behind": the image fills the tile and the text sits at its foot on a scrim that reads on any photo; it needs image (not the media slot) and takes no tone or highlighted (the build stops). The <li> carries data-media-placement. |
| `mediaClass` | `string` | None | More classes for the media box, merged with cn(). A media slot has no inset, so numbers and text keep the card padding; "card-media" gives it the image's inset and corners instead. |
| `headingTag` | `"h2" \| "h3" \| "h4" \| "h5"` | None | Required. The title element. Pass childHeadingTag({ heading, headingTag }) from lib/heading.ts, one level under the section heading. |
| `href` | `string` | None | Makes the whole tile one link: the title is the link, and a click anywhere on the tile follows it. One tab stop, named by the title; a hover underlines the title. Not with the action slot, and not blank or with a blank title (the build stops). |
| `viewText` | `string` | None | A cue at the tile's foot, such as "Learn more", shown with an arrow. Hidden from a screen reader, so the link's name stays the title. Only with href (the build stops without it). |
| `class` | `string` | None | More classes for the <li>, merged with cn(), so yours win on conflicts. Each tile is a named size container (bento-tile), so a large title sizes to its own tile. Its spans read the Bento shell's container, so a tile works only inside Bento. |
| Slot | Description |
| --- | --- |
| `media` | Any visual in the media box, placed by mediaPlacement: a stat, a chart, a logo row, a quote, code, a small UI. It wins over image. It has no ratio: it takes its content's height, or a wide, tall or large tile's free height with the content centered. With href it must hold no control (a link, button, field, video or audio with controls, iframe, contenteditable or tabindex), since the tile's link covers it: the build stops. Use the action slot for those, and leave href off. |
| `action` | A real control at the tile's foot, such as a Button or two, for a tile that is not one link. Not with href (two links in one tile; the build stops). On a behind tile it sits on the scrim with the text: give a Button tone="image". |
Any other attribute goes on the <li>.
## Accessibility
- Renders one <li> holding a card: put it in a Bento list.
- The title is the heading level you pass. Use childHeadingTag so it sits one level under the section heading.
- The image needs alt text; use alt="" only when the picture adds nothing to the title.
- The highlighted tile is marked by its fill and its place, not by color alone: make it the first and the largest.
- A linked tile is one link, and its name is the title: put anything the reader must know in the title or the text. The viewText cue is hidden from a screen reader so the name is not read twice.
BentoTile
ProFor one tile in a Bento section: its size, an icon, title and text, a dark or accent fill, a photo above, beside or behind the text, any visual you add, and a link or button. The bento recipes use it for you.
- File
- BentoTile.astro
- Group
- Data display
- Kind
- Static: no JavaScript
- Examples
- 7
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
In a Bento grid
Seven tiles that fill a four-column Bento grid with no gaps: a large highlighted tile, a tall one with an image that fills its free height, normal ones with and without text, and a wide one. The bento recipes build their tiles from it, so you only need it for your own layout.
This preview did not load.
examples/bentotile/main.astro
---
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
// Your own image file.
import desk from "../../photos/studio-desk.webp";
const heading = "Tiles";
const tag = childHeadingTag({ heading });
---
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass="gap-cards @lg/bento:grid-cols-2 @lg/bento:grid-flow-row-dense @lg/bento:auto-rows-bento @3xl/bento:grid-cols-4">
<BentoTile title="A large, highlighted tile" text="Two by two from 48rem, in the soft accent fill, its title in the subhead role." size="large" highlighted headingTag={tag} />
<BentoTile title="A tall tile" text="Its image fills the free height." size="tall" image={{ src: desk, alt: "A laptop, a framed print and a cactus on a light wood desk." }} headingTag={tag} />
<BentoTile title="A normal tile, title only" headingTag={tag} />
<BentoTile title="A normal tile, with text" text="One cell: its title and a line under it." headingTag={tag} />
<BentoTile title="A wide tile" text="Two cells across." size="wide" headingTag={tag} />
<BentoTile title="Rows of one height" text="Each row is at least the bento row height." headingTag={tag} />
<BentoTile title="No gaps" text="Small tiles fill the holes big ones leave." headingTag={tag} />
</Bento>
</div>With an icon
Four tiles, each with a Lucide icon above the title: in the accent color on the surface and highlighted tiles, in the inverse mark color on the inverse one. The icon is decorative; the title says what it means.
This preview did not load.
examples/bentotile/icon.astro
---
import Accessibility from "@lucide/astro/icons/accessibility";
import Gauge from "@lucide/astro/icons/gauge";
import Layers from "@lucide/astro/icons/layers";
import Palette from "@lucide/astro/icons/palette";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
const heading = "What every theme starts with";
const tag = childHeadingTag({ heading });
---
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass="gap-cards @lg/bento:grid-cols-2 @lg/bento:grid-flow-row-dense @lg/bento:auto-rows-bento @3xl/bento:grid-cols-4">
<BentoTile title="One kit" text="Every Astronomic theme is built from the same parts." icon={Layers} highlighted headingTag={tag} />
<BentoTile title="Presets" text="Fonts, colors and corners change in one place." icon={Palette} headingTag={tag} />
<BentoTile title="Fast pages" text="Small pages with little JavaScript, quick on any phone." icon={Gauge} headingTag={tag} />
<BentoTile title="Built for access" text="Real headings, visible focus and text that reads in light and dark." icon={Accessibility} tone="inverse" headingTag={tag} />
</Bento>
</div>The whole tile as a link
Three tiles with href and a viewText cue ("Read the docs", "See the themes", "Get the pass"): a click anywhere on the tile follows the link, and the tile is one tab stop named by its title. The fourth is not a link and holds a Button in its action slot. The grid is not dense, so the tab order stays in the visual order.
This preview did not load.
examples/bentotile/link.astro
---
import Button from "@astronomic-dev/ui/components/Button.astro";
import BookOpen from "@lucide/astro/icons/book-open";
import LayoutGrid from "@lucide/astro/icons/layout-grid";
import Ticket from "@lucide/astro/icons/ticket";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
const heading = "Start here";
const tag = childHeadingTag({ heading });
---
<!-- A linked tile is one link: click anywhere on it, or Tab to it once. The grid is not dense, so the tab order stays in the visual order. -->
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass="gap-cards @lg/bento:grid-cols-2 @lg/bento:auto-rows-bento @3xl/bento:grid-cols-4">
<BentoTile title="Astronomic UI" text="Every part's props, slots and examples, with notes on access." icon={BookOpen} href="/ui" viewText="Read the docs" headingTag={tag} />
<BentoTile title="Themes for real businesses" text="Studios, newsletters, trades and real estate, all on the same kit." icon={LayoutGrid} href="/themes" viewText="See the themes" headingTag={tag} />
<BentoTile title="The Themes Pass" text="Every Astronomic theme, unlimited sites and lifetime updates." icon={Ticket} href="/pricing" viewText="Get the pass" tone="inverse" headingTag={tag} />
<BentoTile title="Guides for your site" text="Plain guides on Astro, EmDash and moving from WordPress." headingTag={tag}>
<Button slot="action" variant="secondary" size="sm" href="/learn">Read the guides</Button>
</BentoTile>
</Bento>
</div>Text on a photo
mediaPlacement="behind": the photo fills the tile and the text sits at its foot on a scrim that reads on any image. The large tile is one link with a viewText cue; the tall one has a Button with tone="image" in its action slot, on the same scrim.
This preview did not load.
examples/bentotile/behind.astro
---
import Button from "@astronomic-dev/ui/components/Button.astro";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
import { bentoGridSparse } from "@astronomic/ui-pro/lib/bento.ts";
// Your own image files.
import slab from "../../photos/concrete-slab.webp";
import stairway from "../../photos/white-stairway.webp";
const heading = "Text on a photo";
const tag = childHeadingTag({ heading });
---
<!-- The text sits on a scrim that reads on any photo. The large tile is one link; the tall one has a Button (tone="image") on the same scrim. -->
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass={bentoGridSparse}>
<BentoTile
title="Apogee, for studios"
text="Big type, case studies and a quiet grid for the work."
size="large"
mediaPlacement="behind"
image={{ src: stairway, alt: "A white stairwell seen from above." }}
href="/themes/apogee"
viewText="See Apogee"
headingTag={tag}
/>
<BentoTile title="Groundcrew, for trades" text="Quotes, service areas and before and after photos." size="tall" mediaPlacement="behind" image={{ src: slab, alt: "A concrete building against the sky." }} headingTag={tag}>
<Button slot="action" tone="image" size="sm" href="/themes/groundcrew">See Groundcrew</Button>
</BentoTile>
<BentoTile title="Behind needs an image" text="Not a media slot, a tone or highlighted: the photo is the surface." headingTag={tag} />
<BentoTile title="On any photo" text="The scrim reads on black or white, in every preset, light and dark." headingTag={tag} />
</Bento>
</div>Inverse and highlighted
The three fills side by side: the surface, highlighted (the soft accent fill) and tone="inverse" (dark on a light page, light on a dark page). The inverse tile holds a Button with tone="inverse" in its action slot.
This preview did not load.
examples/bentotile/tone.astro
---
import Button from "@astronomic-dev/ui/components/Button.astro";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
import { bentoGridSparse } from "@astronomic/ui-pro/lib/bento.ts";
const heading = "Three fills";
const tag = childHeadingTag({ heading });
---
<!-- One fill per tile. On the inverse tile, give a Button tone="inverse". -->
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass={bentoGridSparse}>
<BentoTile title="Surface" text="The card, as every tile starts." headingTag={tag} />
<BentoTile title="Highlighted" text="The soft accent fill, for the tile to point at." highlighted headingTag={tag} />
<BentoTile title="Lifetime updates" text="Buy a theme once and get every update to it, on unlimited sites." size="wide" tone="inverse" headingTag={tag}>
<Button slot="action" tone="inverse" size="sm" href="/pricing">See pricing</Button>
</BentoTile>
</Bento>
</div>Image beside the text
mediaPlacement="start" and "end": the image goes beside the text once the tile is 28rem wide, two parts to the text's three. The large tile puts it at the end, the wide one at the start. The tall tile is one cell wide, so its start image stacks above the text; narrower, every tile stacks, and end puts the image under the text.
This preview did not load.
examples/bentotile/beside.astro
---
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
// Your own image files.
import shelves from "../../photos/studio-shelves.webp";
import notebook from "../../photos/leather-notebook.webp";
import desk from "../../photos/studio-desk.webp";
const heading = "Image beside the text";
const tag = childHeadingTag({ heading });
---
<!-- start and end go beside the text once the tile is 28rem wide; narrower they stack, start above the text, end below it. -->
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass="gap-cards @lg/bento:grid-cols-2 @lg/bento:grid-flow-row-dense @lg/bento:auto-rows-bento @3xl/bento:grid-cols-4">
<BentoTile
title="Pages your editors can run"
text="Every theme works in plain Astro, with EmDash supported for a full editor. The image sits at the end, after the text."
size="large"
mediaPlacement="end"
image={{ src: notebook, alt: "A tan leather notebook, a pen and a clip on pale gray paper." }}
headingTag={tag}
/>
<BentoTile title="Made for the work" text="The image sits at the start." size="wide" mediaPlacement="start" image={{ src: shelves, alt: "Plates and bowls on white shelves." }} headingTag={tag} />
<BentoTile title="Stacked when narrow" text="A tall tile is one cell wide, so its start image sits above the text." size="tall" mediaPlacement="start" image={{ src: desk, alt: "A laptop, a framed print and a cactus on a light wood desk." }} headingTag={tag} />
<BentoTile title="By the tile's width" text="Not the page's: any size can go beside." headingTag={tag} />
<BentoTile title="Two parts to three" text="The image takes two parts of the row and the text three, the text centered beside it." size="wide" headingTag={tag} />
<BentoTile title="Same order" text="End puts the text first in the page too." headingTag={tag} />
</Bento>
</div>Your own visual
The media slot holds any visual: a stat, a type-scale chart, a row of theme names, a quote, a code snippet and preset swatches. It has no inset, so text and numbers keep the card padding. Keep headings out of it: a stat is a <p>, a quote a <figure>; mark a picture that only decorates aria-hidden.
This preview did not load.
examples/bentotile/visual.astro
---
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Bento from "@astronomic/ui-pro/components/Bento.astro";
import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";
import Star from "../../logos/astronomic-star.svg";
const heading = "Your own visual";
const tag = childHeadingTag({ heading });
// The kit's type roles, largest first, drawn as bars (decorative: the tile's title says what it is).
const scale = [
{ role: "display", width: "100%" },
{ role: "title", width: "80%" },
{ role: "section", width: "64%" },
{ role: "subhead", width: "50%" },
{ role: "heading", width: "38%" },
{ role: "body", width: "26%" },
];
const themes = ["Agency", "Dispatch", "Lodestar", "Vesper", "Apogee", "Vega", "Groundcrew"];
const swatches = ["bg-accent", "bg-accent-soft", "bg-fg", "bg-muted", "bg-surface"];
---
<!-- The media slot takes any visual with no headings: a stat is a <p>, a quote a <figure>. Text-only visuals keep the card padding. -->
<div class="mx-auto max-w-6xl">
<Bento heading={heading} listClass="gap-cards @lg/bento:grid-cols-2 @lg/bento:grid-flow-row-dense @lg/bento:auto-rows-bento @3xl/bento:grid-cols-4">
<BentoTile title="Sites per license" headingTag={tag}>
<p slot="media" class="m-0 display-face text-section leading-none text-accent">Unlimited</p>
</BentoTile>
<BentoTile title="Seven themes, one kit" text="Each one built on Astronomic UI." size="wide" headingTag={tag}>
<div slot="media" class="flex flex-wrap items-center gap-x-5 gap-y-2">
<Star class="size-6 shrink-0" aria-hidden="true" />
{themes.map((name) => <span class="heading-face text-body font-semibold">{name}</span>)}
</div>
</BentoTile>
<BentoTile title="A type scale" text="Six roles, display to body." headingTag={tag}>
<div slot="media" aria-hidden="true" class="grid gap-1.5 text-accent">
{
scale.map((step) => (
<div class="grid grid-cols-[4.5rem_1fr] items-center gap-2">
<span class="text-small text-muted">{step.role}</span>
<span class="h-2 rounded-full bg-current" style={`width: ${step.width}`} />
</div>
))
}
</div>
</BentoTile>
<BentoTile title="One import" text="Each part is one Astro file." size="wide" headingTag={tag}>
<pre slot="media" class="m-0 rounded-md bg-inverse p-4 text-small whitespace-pre-wrap text-on-inverse [overflow-wrap:anywhere]"><code>import BentoTile from "@astronomic/ui-pro/components/BentoTile.astro";</code></pre>
</BentoTile>
<BentoTile title="From the design principles" headingTag={tag}>
<figure slot="media" class="m-0 grid gap-2">
<blockquote class="m-0 heading-face text-heading text-balance">“Size to the box, not the page.”</blockquote>
<figcaption class="text-small text-muted">Astronomic UI design principles</figcaption>
</figure>
</BentoTile>
<BentoTile title="Presets change the look" headingTag={tag}>
<div slot="media" aria-hidden="true" class="flex flex-wrap gap-2">
{swatches.map((fill) => <span class={`size-8 rounded-full border border-border ${fill}`} />)}
</div>
</BentoTile>
</Bento>
</div>