Bento Grid for Astro
A six-column Astro grid of raised cards, each with a fading visual and a soft top light.
Installation
bunx --bun shadcn@latest add @gnostic/bento-gridnpx shadcn@latest add @gnostic/bento-gridpnpm dlx shadcn@latest add @gnostic/bento-gridCopy the files
src/components/ui/bento-grid/bento-card-content.astrosrc/components/ui/bento-grid/bento-card-description.astrosrc/components/ui/bento-grid/bento-card-title.astrosrc/components/ui/bento-grid/bento-card-visual.astrosrc/components/ui/bento-grid/bento-card.astrosrc/components/ui/bento-grid/bento-grid.astrosrc/components/ui/bento-grid/bento-light.astrosrc/components/ui/bento-grid/bento-panel.astrosrc/components/ui/bento-grid/index.tssrc/components/ui/bento-grid/types.ts
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.
Composition
BentoGrid
└── BentoCard
├── BentoLight
├── BentoCardVisual
│ └── BentoPanel
└── BentoCardContent
├── BentoCardTitle
└── BentoCardDescription
Props
BentoCardTitleProps
as?HTMLTag
The HTML tag for the title.
HTMLTag"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.

