Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Bento Grid for Astro

A six-column Astro grid of raised cards, each with a fading visual and a soft top light.

  • Shore path08:10
  • Upper meadow09:40
  • The falls11:15

Morning walk

Three stops, with time to sit at the last one.

A snow-capped mountain rises above a still lake, with autumn trees along the shore.

Still water

The peak sits in the lake until the clouds move.

A waterfall drops through a green valley, with a stream in the foreground.

The falls

Water drops through the meadow in the late light.

Today

Light
Clear
Wind
Light
Trail
Dry

Conditions

Clear air and a dry trail for the whole walk.

Write the light down before you leave the shore.

Field note

A short line is enough. The picture holds the rest.

Installation

bunx --bun shadcn@latest add @gnostic/bento-grid

Usage

---
import {
  BentoCard,
  BentoCardContent,
  BentoCardDescription,
  BentoCardTitle,
  BentoCardVisual,
  BentoGrid,
  BentoLight,
  BentoPanel,
} from "@/components/ui/bento-grid"
---

<BentoGrid class="max-w-3xl">
  <BentoCard class="[--bento-light:--theme(--color-primary)] md:col-span-3">
    <BentoLight />
    <BentoCardVisual>
      <BentoPanel class="w-full max-w-72 p-4">Your visual</BentoPanel>
    </BentoCardVisual>
    <BentoCardContent>
      <BentoCardTitle>Deploy with confidence</BentoCardTitle>
      <BentoCardDescription>
        Every pull request runs the same checks before it merges.
      </BentoCardDescription>
    </BentoCardContent>
  </BentoCard>
</BentoGrid>

BentoGrid uses container queries to set the number of columns.

Container width Columns
0 - 448px 1
448px - 768px 4
> 768px 6

Rows are at least 18rem tall and grow with the content.

A BentoCard spans 2 columns for container widths above 448px by default.

Put BentoLight and BentoCardVisual first. Put the title and the description in BentoCardContent. The visual fades into the card, so a fragment can leave the stage. BentoPanel is a raised window, toast, or palette on that stage.

Light Effect

BentoLight is decorative. It sits behind the card content. Hover makes it slightly larger. prefers-reduced-motion: reduce keeps it still.

The card sets --highlight for the one-pixel top edge and --glow for the neutral haze. The panel inherits the same edge color.

Set --bento-light on the card to add a tinted haze and color the dots and the centered line. The accent defaults to the foreground color.

<BentoCard class="[--bento-light:var(--color-primary)]">
  <BentoLight />
</BentoCard>

Wide row

Set --bento-light to var(--primary) to tint each card. Two cards share the top row. The third card fills the row under them.

On air

Night window

Side A, one take

Evening hour

One host, one room, and a short set.

Queue

  1. 1North window3:12
  2. 2Late lamp4:05
  3. 3Side A2:48

Next up

The next three pieces stay in this order.

Room
Warm
Mic
Quiet
Set
18 min

The room

Warm light, a quiet mic, and time for one more piece.

Composition

BentoGrid
└── BentoCard
    ├── BentoLight
    ├── BentoCardVisual
    │   └── BentoPanel
    └── BentoCardContent
        ├── BentoCardTitle
        └── BentoCardDescription

Props

BentoCardTitleProps

PropType
as?HTMLTag

The HTML tag for the title.

TypeHTMLTag
Default"h3"

The title renders an h3 by default. Set as when the page outline needs another level. The other parts have no props of their own. Their element attributes pass through.

Read the installed source for the complete markup.

Slots

Part Slot Content
BentoGrid Default BentoCard tiles.
BentoCard Default Light, visual, and copy.
BentoLight Default Optional extra light content. Usually empty.
BentoCardVisual Default The picture or interface fragment.
BentoPanel Default A raised fragment on the stage.
BentoCardContent Default Title, description, and extra copy.
BentoCardTitle Default The card name.
BentoCardDescription Default Supporting text.

Keyboard and behavior

The light is hidden from assistive technology. The card does not add a control. Put a link or a button in the visual or the copy when the card needs an action.