Bento
Bento and BentoTile: a container-query grid of Card tiles that spans columns on wide containers, falls to two columns and then one, and can make a whole tile a link without covering the controls inside.
Example
Spans four of six columns
Two of two on a medium container.
Two columns
Half of a medium container.
HealthyDegraded
A linked tile
The whole tile follows its link.
One column on a phone
Tiles stack below 48rem of container width.
bento-demo.tsxCopy code
Installation
Copy code
Usage
ImportCopy code
Bento lays out tiles by its container's width: one column, two from 48rem, columns from 64rem. BentoTile spans columns and holds any live demo.
API reference
Bento
| Prop | Type | Default |
|---|---|---|
columnsColumns on a wide container (64rem and up). Between 48rem and 64rem the grid has two; below, one. | number | 6 |
Also takes <div> attributes.
BentoTile
| Prop | Type | Default |
|---|---|---|
spanColumns the tile spans on a wide container; it takes the full width of the two-column layout when over half. | number | 1 |
rowSpan | number | 1 |
eyebrow | ReactNode | – |
titlerequired | ReactNode | – |
description | ReactNode | – |
headingLevel | 2 | 3 | 4 | 3 |
hrefMakes the whole tile a link named by its title; controls inside the tile stay their own targets. | string | – |
onFollow | LinkProps["onFollow"] | – |
children | ReactNode | – |
Also takes <section> attributes except title.
Other exports
type BentoPropstype BentoTilePropsAccessibility
- Each tile is a Card section named by its title.
- With href the title is the link and its hit area covers the tile, while controls inside stay their own targets.
Agent actions
Tiles are content; their links take onFollow to be followable by agents, and controls inside are their own parts.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.