Cómo funciona
The root is an inline-size container, so columns follow the space the grid really has: four from 640px, two from 360px, one below. grid-auto-flow: dense backfills holes when spans do not line up. On two columns a large tile becomes 2×1; on one column all tiles are 1×1 and stack in source order, which is also the reading and tab order.
Úsalo para
- A feature overview on a landing or pricing page.
- A dashboard home with a few unequal widgets.
Busca otra opción cuando
- Long, uniform collections: use a list or a masonry grid.
- Content whose order matters more than its emphasis: dense packing can move small tiles up.
Uso
import { BentoGrid } from './BentoGrid.jsx'
const features = [
{ id: 'plan', span: 'large', eyebrow: 'Planning', title: 'Boards that stay tidy', description: 'Drag work between stages.', visual: <BoardArt /> },
{ id: 'sync', span: 'small', title: 'Live in every tab', visual: <SyncArt /> },
{ id: 'privacy', span: 'small', title: 'Private by default' },
{ id: 'report', span: 'wide', title: 'Weekly focus report', href: '/reports' },
]
export function Features() {
return <BentoGrid items={features} gap={12} />
}Propiedades
| Propiedad | Tipo | Por defecto | Qué hace |
|---|---|---|---|
items | { id?, span?, eyebrow?, title, description?, visual?, tone?, href?, onClick? }[] | — | The tiles. span is 'small' (1×1), 'wide' (2×1), 'tall' (1×2) or 'large' (2×2); tone 'accent' or 'ink' changes the fill. With href or onClick the tile is a link or button. |
gap | number | 12 | Space between tiles in px. |
rowHeight | number | 152 | Minimum row height in px; rows grow to fit their content. |
spotlight | boolean | true | A soft accent glow that follows the pointer on hover. |
...rest | HTMLAttributes<HTMLDivElement> | — | Passed to the root, which is the size container. |
Accesibilidad
- The grid is a list (ul / li), so screen readers announce the number of tiles.
- Tiles with href render as links and with onClick as buttons, with a 4px accent focus ring; others are plain content.
- Dense packing changes only the visual position; keep the source order meaningful.
- Reduced motion replaces the staggered rise with a 200ms fade and removes the hover lift.
Movimiento
Tiles rise 12px from scale 0.98 over 560ms ease-out, 50ms apart. Interactive tiles lift 2px with a deeper shadow in 260ms; the spotlight fades in over 320ms.
Añádelo a tu proyecto
Copia la instrucción en Codex o Claude Code. El agente lee el código publicado, te muestra lo que va a escribir y añade el componente junto a los tuyos.
BentoGrid.jsxbento-grid.csstokens.cssREADME.md
Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.





