Components

Animated Grid

Background grid pattern with glassmorphic cells and radial fade mask

Animated Grid

A decorative background grid component featuring glassmorphic cells with radial gradient masking. Perfect for creating depth and visual interest behind content.

Usage

import { AnimatedGrid, GridCell, Grid3x3 } from "@/components/ui/animated-grid";

export default function Example() {
  return (
    <AnimatedGrid>
      <GridCell />
      <GridCell />
      <GridCell />
      <GridCell />
      <GridCell span={2} />
      <GridCell />
      <GridCell />
      <GridCell />
    </AnimatedGrid>
  );
}

Components

AnimatedGrid

The container component that provides radial masking and positioning.

GridCell

Individual grid cell with glassmorphic border styling.

Grid3x3

Convenience component that renders the Bento10 3×3 grid pattern automatically.

Props

AnimatedGrid Props

PropTypeDefaultDescription
size"sm" | "default" | "lg" | "full""default"Grid container size
centeredbooleantrueCenter grid horizontally
rowsnumber3Number of rows
colsnumber3Number of columns
gapnumber4Gap between cells (px)
paddingnumber42Inner padding (px)

GridCell Props

PropTypeDefaultDescription
size"sm" | "default" | "lg""default"Cell size
variant"default" | "glow""default"Visual style
spannumber1Horizontal span (columns)
spanHeightnumber1Vertical span (rows)

Grid3x3 Props

PropTypeDefaultDescription
cellSizeGridCell["size"]"default"Size of all cells
cellVariantGridCell["variant"]"default"Variant of all cells
customCellsReactNode-Custom cell layout

Variants

Size Variants

// Small - 280px container
<AnimatedGrid size="sm">...</AnimatedGrid>

// Default - 336px container
<AnimatedGrid size="default">...</AnimatedGrid>

// Large - 400px container
<AnimatedGrid size="lg">...</AnimatedGrid>

// Full - 100% width/height
<AnimatedGrid size="full">...</AnimatedGrid>

Cell Variants

// Default - simple border
<GridCell variant="default" />

// Glow - with radial gradient overlay
<GridCell variant="glow" />

Examples

Basic 3×3 Grid

<Grid3x3 />

This renders the Bento10 pattern automatically with proper cell spanning.

Custom Grid Layout

<AnimatedGrid rows={4} cols={4} gap={8}>
  <GridCell />
  <GridCell span={2} />
  <GridCell />
  <GridCell spanHeight={2} />
  <GridCell />
  <GridCell />
  <GridCell spanHeight={2} />
  <GridCell span={2} />
  <GridCell />
  <GridCell />
  <GridCell />
  <GridCell span={2} />
</AnimatedGrid>

With Content Overlay

<div className="relative">
  <AnimatedGrid size="full" className="absolute inset-0 -z-10" />
  <div className="relative z-10 p-8">
    <h2>Content on top of grid</h2>
  </div>
</div>

Custom Cell Sizes

<AnimatedGrid>
  <GridCell size="sm" />
  <GridCell size="default" />
  <GridCell size="lg" />
</AnimatedGrid>

Spanning Cells

<AnimatedGrid>
  {/* Spans 2 columns */}
  <GridCell span={2} />
  <GridCell />
  
  {/* Spans 2 rows */}
  <GridCell spanHeight={2} />
  
  {/* Spans 2 columns and 2 rows */}
  <GridCell span={2} spanHeight={2} />
</AnimatedGrid>

With Glow Effect

<Grid3x3 cellVariant="glow" />

Design Tokens

Dimensions

SizeContainerCell SizeGap
sm280px × 280px48px4px
default336px × 336px60px4px
lg400px × 400px80px4px

Effects

TokenValueDescription
Bordervar(--ui-stroke-subtle)rgba(248, 248, 248, 0.1)
Border widthvar(--border-width-default)1.5px
Border radiusvar(--radius-lg)16px
Maskvar(--gradient-radial-center)Radial fade to transparent
Glowvar(--gradient-radial-center-90)Radial gradient overlay

Cell Spanning

The span and spanHeight props automatically calculate dimensions:

width = cellSize × span + gap × (span - 1)
height = cellSize × spanHeight + gap × (spanHeight - 1)

Example:

  • Cell size: 60px
  • Gap: 4px
  • Span: 2
  • Width: 60 × 2 + 4 × 1 = 124px

Bento10 Pattern

The Grid3x3 component recreates the exact Bento10 grid layout:

┌─────────┬───┐
│  Cell 1 │ 3 │  ← Cell 1 spans 2 columns
├───┬─────┴───┤
│ 4 │  Cell 5 │  ← Cell 4, 5, 6 span 2 rows
│   ├─────┬───┤  ← Cell 5 spans 2×2 (hidden in Bento10)
│   │  6  │ 7 │
├───┴─────┴───┤
│ 8 │ Cell 9  │  ← Cell 9 spans 2 columns
└───┴─────────┘

Found In

  • Bento1 - Grid background with cursor overlay
  • Bento10 - Collaboration grid with avatars
  • Bento18 - File system grid
  • Bento21 - Team workspace grid

Accessibility

  • Decorative background element (no interactive content)
  • Uses aria-hidden="true" when purely decorative
  • Does not interfere with content focus order
  • Radial mask ensures content remains readable

Performance

  • Pure CSS implementation (no JavaScript animations)
  • Uses CSS Grid for efficient layout
  • Radial mask applied via CSS (hardware accelerated)
  • Minimal DOM nodes (container + cells)

On this page