Pages
Bento

Bento Grid

A product bento grid for React where every card is a working mini UI: an interactive revenue chart, connectable integrations, a live activity feed, uptime and collaboration cursors.

bento-grid.preview

Platform

Everything your team needs to ship

Analytics, integrations, collaboration and monitoring in one place, so nobody has to switch tabs to find out what happened.

See all features

Revenue · 30 days

$48.2k+12.6%

Know where you stand

Live revenue, signups and trends in one view. Hover the chart to read any day.

Connect your stack

Turn integrations on with a click.

Last 30 days

Reliable by default

99.98% uptime over the last 30 days.

Maya
Leo

Build together

See who's editing, in real time.

  • Deployed to productionweb · 42s
  • Maya commented on #482“Ship it”
  • New signup from BerlinTeam plan

Nothing slips through

Every deploy, comment and payment lands in one feed.

Install

Copies the source into components/blocks/bento-grid.tsx and installs what it needs.

$ pnpm dlx shadcn@latest add https://makeui.xyz/r/bento-grid.json

Usage

app/page.tsx
import { BentoGrid } from "@/components/blocks/bento-grid"

export default function Page() {
  return (
    <BentoGrid
      eyebrow="Platform"
      title="Everything your team needs to ship"
      // optional: pass your own cards, each with any visual
      items={[
        {
          title: "Fast by default",
          description: "Static where it can be, dynamic where it has to be.",
          visual: <MyChart />,
          className: "@3xl:col-span-2 @3xl:row-span-2",
        },
        { title: "Typed", description: "End to end.", visual: <MyBadge /> },
      ]}
    />
  )
}

Source

Prefer to copy by hand? It's one file. Requires motion and the shadcn cn helper.

components/blocks/bento-grid.tsx
"use client"

import { useEffect, useMemo, useState } from "react"
import { AnimatePresence, motion, useReducedMotion } from "motion/react"
import { ArrowUpRight, Check, Cloud, CreditCard, Database, GitBranch, Mail, MessageSquare, Rocket, UserPlus, MessageCircle, ReceiptText } from "lucide-react"
import { cn } from "@/lib/utils"

export type BentoItem = {
  title: string
  description: string
  /** Anything: a small live UI, an image, a chart. Sits above the text. */
  visual?: React.ReactNode
  /** Tailwind span classes, e.g. "@3xl:col-span-2 @3xl:row-span-2". */
  className?: string
}

type Props = {
  eyebrow?: string
  title?: string
  description?: string
  items?: BentoItem[]
  className?: string
}

/* ---------------------------------------------------------------- visuals
   Small working UIs, so each card shows the product instead of describing it. */

const ranges = {
  "7d": { label: "7 days", total: "$12.4k", delta: "+8.2%", data: [38, 44, 41, 52, 49, 61, 68] },
  "30d": { label: "30 days", total: "$48.2k", delta: "+12.6%", data: [32, 36, 33, 41, 39, 45, 43, 52, 50, 58, 61, 67] },
  "90d": { label: "90 days", total: "$131k", delta: "+21.4%", data: [20, 24, 22, 29, 27, 33, 31, 38, 36, 42, 47, 45, 53, 58, 56, 64, 70, 76] },
} as const
type RangeKey = keyof typeof ranges

const CW = 420
const CH = 170

/** Smooth line through the points (Catmull-Rom turned into cubic Béziers). */
function curve(pts: [number, number][]) {
  let d = `M${pts[0][0]} ${pts[0][1]}`
  for (let i = 0; i < pts.length - 1; i++) {
    const p0 = pts[i - 1] ?? pts[i]
    const p1 = pts[i]
    const p2 = pts[i + 1]
    const p3 = pts[i + 2] ?? p2
    const c1 = [p1[0] + (p2[0] - p0[0]) / 6, p1[1] + (p2[1] - p0[1]) / 6]
    const c2 = [p2[0] - (p3[0] - p1[0]) / 6, p2[1] - (p3[1] - p1[1]) / 6]
    d += ` C${c1[0].toFixed(1)} ${c1[1].toFixed(1)} ${c2[0].toFixed(1)} ${c2[1].toFixed(1)} ${p2[0]} ${p2[1]}`
  }
  return d
}

function Revenue() {
  const [range, setRange] = useState<RangeKey>("30d")
  const [hover, setHover] = useState<number | null>(null)
  const reduce = useReducedMotion()
  const r = ranges[range]

  const pts = useMemo(() => {
    const max = 90
    return r.data.map((v, i) => [(i / (r.data.length - 1)) * CW, CH - 12 - (v / max) * (CH - 28)] as [number, number])
  }, [r])
  const line = curve(pts)
  const area = `${line} L${CW} ${CH} L0 ${CH} Z`
  const h = hover === null ? pts.length - 1 : hover
  const value = Math.round(r.data[h] * 0.72)

  return (
    <div className="flex h-full flex-col">
      <div className="flex items-start justify-between gap-3">
        <div>
          <p className="text-xs text-neutral-500 dark:text-neutral-400">Revenue · {r.label}</p>
          <div className="mt-1 flex items-baseline gap-2">
            <span className="text-3xl font-medium tracking-[-0.03em] text-neutral-900 dark:text-neutral-50">{r.total}</span>
            <span className="rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-600 dark:text-emerald-400">{r.delta}</span>
          </div>
        </div>
        <div role="tablist" aria-label="Range" className="flex rounded-full bg-neutral-200/60 p-0.5 dark:bg-neutral-800">
          {(Object.keys(ranges) as RangeKey[]).map((k) => (
            <button
              key={k}
              role="tab"
              aria-selected={range === k}
              onClick={() => {
                setRange(k)
                setHover(null)
              }}
              className="relative rounded-full px-2.5 py-1 text-xs outline-none focus-visible:ring-2 focus-visible:ring-neutral-400/60"
            >
              {range === k && (
                <motion.span layoutId="bento-range" className="absolute inset-0 rounded-full bg-white shadow-sm dark:bg-neutral-700" transition={{ type: "spring", stiffness: 500, damping: 36 }} />
              )}
              <span className={cn("relative", range === k ? "text-neutral-900 dark:text-neutral-50" : "text-neutral-500")}>{k}</span>
            </button>
          ))}
        </div>
      </div>

      <div
        className="relative mt-4 min-h-0 flex-1 cursor-crosshair"
        onPointerMove={(e) => {
          const b = e.currentTarget.getBoundingClientRect()
          setHover(Math.round(Math.min(1, Math.max(0, (e.clientX - b.left) / b.width)) * (pts.length - 1)))
        }}
        onPointerLeave={() => setHover(null)}
      >
        <svg viewBox={`0 0 ${CW} ${CH}`} preserveAspectRatio="none" className="absolute inset-0 size-full overflow-visible" aria-label="Revenue chart" role="img">
          <defs>
            <linearGradient id="bento-area" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" stopColor="#6366f1" stopOpacity="0.28" />
              <stop offset="1" stopColor="#6366f1" stopOpacity="0" />
            </linearGradient>
          </defs>
          {[0.25, 0.5, 0.75].map((t) => (
            <line key={t} x1="0" x2={CW} y1={CH * t} y2={CH * t} className="stroke-neutral-200 dark:stroke-neutral-800" strokeDasharray="3 5" vectorEffect="non-scaling-stroke" />
          ))}
          <motion.path key={`a-${range}`} d={area} fill="url(#bento-area)" initial={reduce ? false : { opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: 0.6, delay: 0.2 }} />
          <motion.path
            key={`l-${range}`}
            d={line}
            fill="none"
            stroke="#6366f1"
            strokeWidth="2.5"
            strokeLinecap="round"
            vectorEffect="non-scaling-stroke"
            initial={reduce ? false : { pathLength: 0 }}
            animate={{ pathLength: 1 }}
            transition={{ duration: 0.9, ease: [0.45, 0.05, 0.25, 1] }}
          />
          {hover !== null && <line x1={pts[h][0]} x2={pts[h][0]} y1="0" y2={CH} className="stroke-neutral-300 dark:stroke-neutral-700" vectorEffect="non-scaling-stroke" />}
        </svg>

        {hover !== null && (
          <div className="pointer-events-none absolute" style={{ left: `${(pts[h][0] / CW) * 100}%`, top: `${(pts[h][1] / CH) * 100}%` }}>
            <span className="absolute -left-1.5 -top-1.5 size-3 rounded-full bg-indigo-500 ring-4 ring-white dark:ring-neutral-900" />
            <span
              className={cn(
                "absolute -top-11 whitespace-nowrap rounded-lg bg-neutral-900 px-2.5 py-1 text-xs font-medium text-white shadow-lg dark:bg-white dark:text-neutral-900",
                h > pts.length * 0.7 ? "right-0" : h < pts.length * 0.15 ? "left-0" : "-translate-x-1/2"
              )}
            >
              ${value}k
            </span>
          </div>
        )}
      </div>
    </div>
  )
}

const apps = [
  { name: "Git", icon: GitBranch, tint: "bg-orange-500/10 text-orange-600 dark:text-orange-400" },
  { name: "Chat", icon: MessageSquare, tint: "bg-violet-500/10 text-violet-600 dark:text-violet-400" },
  { name: "Database", icon: Database, tint: "bg-sky-500/10 text-sky-600 dark:text-sky-400" },
  { name: "Cloud", icon: Cloud, tint: "bg-cyan-500/10 text-cyan-600 dark:text-cyan-400" },
  { name: "Email", icon: Mail, tint: "bg-rose-500/10 text-rose-600 dark:text-rose-400" },
  { name: "Payments", icon: CreditCard, tint: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400" },
]

function Integrations() {
  const [on, setOn] = useState<string[]>(["Git", "Chat", "Payments"])
  return (
    <div className="grid h-full grid-cols-3 content-center gap-2">
      {apps.map((a) => {
        const active = on.includes(a.name)
        return (
          <button
            key={a.name}
            aria-pressed={active}
            aria-label={`${a.name}, ${active ? "connected" : "not connected"}`}
            onClick={() => setOn((v) => (active ? v.filter((n) => n !== a.name) : [...v, a.name]))}
            className={cn(
              "relative flex aspect-square flex-col items-center justify-center gap-1.5 rounded-2xl border text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-neutral-400/60",
              active
                ? "border-neutral-300 bg-white text-neutral-900 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-50"
                : "border-dashed border-neutral-300 text-neutral-400 hover:border-neutral-400 dark:border-neutral-700 dark:text-neutral-500"
            )}
          >
            <span className={cn("grid size-8 place-items-center rounded-xl transition-opacity", active ? a.tint : "bg-neutral-100 dark:bg-neutral-800", !active && "opacity-70")}>
              <a.icon className="size-4" />
            </span>
            {a.name}
            <AnimatePresence>
              {active && (
                <motion.span
                  initial={{ scale: 0 }}
                  animate={{ scale: 1 }}
                  exit={{ scale: 0 }}
                  transition={{ type: "spring", stiffness: 500, damping: 24 }}
                  className="absolute right-1.5 top-1.5 grid size-4 place-items-center rounded-full bg-emerald-500 text-white"
                >
                  <Check className="size-2.5" strokeWidth={4} />
                </motion.span>
              )}
            </AnimatePresence>
          </button>
        )
      })}
    </div>
  )
}

const events = [
  { icon: Rocket, text: "Deployed to production", meta: "web · 42s", tint: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400" },
  { icon: MessageCircle, text: "Maya commented on #482", meta: "“Ship it”", tint: "bg-indigo-500/10 text-indigo-600 dark:text-indigo-400" },
  { icon: UserPlus, text: "New signup from Berlin", meta: "Team plan", tint: "bg-sky-500/10 text-sky-600 dark:text-sky-400" },
  { icon: ReceiptText, text: "Invoice paid", meta: "$240.00", tint: "bg-amber-500/10 text-amber-600 dark:text-amber-400" },
  { icon: GitBranch, text: "Pull request merged", meta: "#491 · fix/auth", tint: "bg-orange-500/10 text-orange-600 dark:text-orange-400" },
]

function Activity() {
  const reduce = useReducedMotion()
  const [feed, setFeed] = useState(() => [0, 1, 2].map((i) => ({ ...events[i], id: i })))
  useEffect(() => {
    if (reduce) return
    let n = 3
    const t = setInterval(() => {
      setFeed((f) => [{ ...events[n % events.length], id: n++ }, ...f].slice(0, 3))
    }, 3200)
    return () => clearInterval(t)
  }, [reduce])

  return (
    <ul className="flex h-full flex-col justify-center gap-2 overflow-hidden" aria-live="off">
      <AnimatePresence initial={false} mode="popLayout">
        {feed.map((e) => (
          <motion.li
            key={e.id}
            layout
            initial={{ opacity: 0, y: -16, scale: 0.97 }}
            animate={{ opacity: 1, y: 0, scale: 1 }}
            exit={{ opacity: 0, scale: 0.96 }}
            transition={{ type: "spring", stiffness: 300, damping: 28 }}
            className="flex items-center gap-3 rounded-xl border border-neutral-200 bg-white px-3 py-2.5 dark:border-neutral-800 dark:bg-neutral-800/60"
          >
            <span className={cn("grid size-8 shrink-0 place-items-center rounded-lg", e.tint)}>
              <e.icon className="size-4" />
            </span>
            <span className="min-w-0 flex-1 truncate text-sm text-neutral-800 dark:text-neutral-100">{e.text}</span>
            <span className="shrink-0 text-xs text-neutral-400">{e.meta}</span>
          </motion.li>
        ))}
      </AnimatePresence>
    </ul>
  )
}

const days = Array.from({ length: 30 }, (_, i) => ({ day: i + 1, status: i === 11 ? "slow" : i === 23 ? "down" : "ok" }))

function Uptime() {
  const [hover, setHover] = useState<number | null>(null)
  const d = hover === null ? null : days[hover]
  return (
    <div className="flex h-full flex-col justify-center">
      <div className="flex items-end gap-[3px]" onPointerLeave={() => setHover(null)}>
        {days.map((x, i) => (
          <motion.span
            key={x.day}
            onPointerEnter={() => setHover(i)}
            initial={{ scaleY: 0.2, opacity: 0 }}
            whileInView={{ scaleY: 1, opacity: 1 }}
            viewport={{ once: true }}
            transition={{ type: "spring", stiffness: 200, damping: 20, delay: i * 0.015 }}
            className={cn(
              "h-9 flex-1 origin-bottom rounded-full transition-colors",
              x.status === "ok" && "bg-emerald-500/80 hover:bg-emerald-500",
              x.status === "slow" && "bg-amber-400 hover:bg-amber-500",
              x.status === "down" && "bg-rose-500/90 hover:bg-rose-500"
            )}
          />
        ))}
      </div>
      <p className="mt-3 h-4 text-xs text-neutral-500 dark:text-neutral-400">
        {d ? `Day ${d.day}: ${d.status === "ok" ? "operational" : d.status === "slow" ? "degraded, 4 min" : "outage, 9 min"}` : "Last 30 days"}
      </p>
    </div>
  )
}

function Cursors() {
  const reduce = useReducedMotion()
  const cursor = (color: string, name: string, x: number[], y: number[], dur: number) => (
    <motion.div
      className="absolute left-0 top-0"
      animate={reduce ? { x: x[0], y: y[0] } : { x, y }}
      transition={{ duration: dur, repeat: Infinity, ease: "easeInOut" }}
    >
      <svg width="16" height="16" viewBox="0 0 16 16" fill={color} aria-hidden>
        <path d="M2 1l11 5-4.5 1.5L7 12z" stroke="white" strokeWidth="1" strokeLinejoin="round" />
      </svg>
      <span className="ml-3 -mt-0.5 inline-block rounded-md px-1.5 py-0.5 text-[10px] font-medium text-white" style={{ background: color }}>
        {name}
      </span>
    </motion.div>
  )
  return (
    <div className="relative h-full overflow-hidden rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-800/60">
      <div className="h-2.5 w-1/3 rounded-full bg-neutral-300 dark:bg-neutral-600" />
      <div className="mt-3 space-y-2">
        <div className="h-2 w-full rounded-full bg-neutral-200 dark:bg-neutral-700" />
        <div className="h-2 w-5/6 rounded-full bg-neutral-200 dark:bg-neutral-700" />
        <div className="h-2 w-2/3 rounded-full bg-neutral-200 dark:bg-neutral-700" />
      </div>
      <div className="mt-4 h-8 w-24 rounded-lg bg-indigo-500/15 ring-1 ring-indigo-500/30" />
      {cursor("#6366f1", "Maya", [30, 150, 90, 30], [20, 60, 90, 20], 7)}
      {cursor("#f43f5e", "Leo", [170, 60, 130, 170], [90, 30, 70, 90], 9)}
    </div>
  )
}

const defaultItems: BentoItem[] = [
  {
    title: "Know where you stand",
    description: "Live revenue, signups and trends in one view. Hover the chart to read any day.",
    visual: <Revenue />,
    className: "@3xl:col-span-2 @3xl:row-span-2",
  },
  { title: "Connect your stack", description: "Turn integrations on with a click.", visual: <Integrations /> },
  { title: "Reliable by default", description: "99.98% uptime over the last 30 days.", visual: <Uptime /> },
  { title: "Build together", description: "See who's editing, in real time.", visual: <Cursors /> },
  { title: "Nothing slips through", description: "Every deploy, comment and payment lands in one feed.", visual: <Activity />, className: "@3xl:col-span-2" },
]

/** Bento grid for a product page: mixed-size cards, each a small working UI. Lays out by its container, not the screen. */
export function BentoGrid({
  eyebrow = "Platform",
  title = "Everything your team needs to ship",
  description = "Analytics, integrations, collaboration and monitoring in one place, so nobody has to switch tabs to find out what happened.",
  items = defaultItems,
  className,
}: Props) {
  return (
    <div className="@container">
      <section className={cn("bg-white px-6 py-20 dark:bg-neutral-950 @3xl:py-28", className)}>
        <div className="mx-auto max-w-5xl">
          <div className="flex flex-wrap items-end justify-between gap-6">
            <div className="max-w-2xl">
              <p className="text-sm text-neutral-500 dark:text-neutral-400">{eyebrow}</p>
              <h2 className="mt-3 text-balance text-4xl font-medium leading-[1.06] tracking-[-0.035em] text-neutral-900 dark:text-neutral-50 @3xl:text-5xl">
                {title}
              </h2>
              <p className="mt-4 text-pretty text-base leading-relaxed text-neutral-600 dark:text-neutral-400">{description}</p>
            </div>
            <a
              href="#"
              className="group inline-flex items-center gap-1.5 text-sm text-neutral-600 transition-colors hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-neutral-50"
            >
              See all features
              <ArrowUpRight className="size-4 transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5" />
            </a>
          </div>

          <div className="mt-12 grid grid-cols-1 gap-4 @3xl:auto-rows-[17rem] @3xl:grid-cols-3">
            {items.map((item, i) => (
              <motion.article
                key={item.title}
                initial={{ opacity: 0, y: 16 }}
                whileInView={{ opacity: 1, y: 0 }}
                viewport={{ once: true, margin: "0px 0px -8% 0px" }}
                transition={{ type: "spring", stiffness: 120, damping: 20, delay: i * 0.05 }}
                className={cn(
                  "flex min-h-72 flex-col overflow-hidden rounded-3xl border border-neutral-200 bg-neutral-50 p-5 dark:border-neutral-800 dark:bg-neutral-900",
                  item.className
                )}
              >
                <div className="min-h-0 flex-1">{item.visual}</div>
                <div className="mt-4">
                  <h3 className="text-[17px] font-medium tracking-[-0.01em] text-neutral-900 dark:text-neutral-50">{item.title}</h3>
                  <p className="mt-1 text-sm leading-relaxed text-neutral-600 dark:text-neutral-400">{item.description}</p>
                </div>
              </motion.article>
            ))}
          </div>
        </div>
      </section>
    </div>
  )
}