Skip to content
Primitives

Bento Grid

Asymmetric grid of tiles that span varied columns and rows — pair BentoGrid with BentoCard cells.

MotionfadeUp reveal on scroll (viewportOnce) + interaction.cardHover lift per tile

Install

Install Kineto and follow the theme setup once in your app.

bash
npm install kineto
tsx
import { BentoGrid, BentoCard } from "kineto/bento-grid";

Preview

Built to scale

Tiles span columns and rows to build an editorial rhythm — no fixed template.

$0

Revenue this quarter

Realtime

A tall tile is just rowSpan={2} — perfect for a feed or a chart.

Secure

Radix under the hood.

Themeable

HSL tokens, light & dark.

tsx
"use client";

import * as React from "react";
import { motion, type HTMLMotionProps } from "motion/react";
import { type LucideIcon } from "lucide-react";

import { cn } from "@/lib/cn";
import { fadeUp, interaction, spring, viewportOnce } from "@/lib/motion-presets";

/* -------------------------------------------------------------------------------------------------
 * BentoGrid — an asymmetric "bento" layout of tiles that span different numbers of columns/rows.
 * Pair the `BentoGrid` container with `BentoCard` cells; give cells `colSpan`/`rowSpan` to build the
 * varied rhythm. Cells stack to a single column on small screens, so spans only apply from `md` up.
 * Each cell reveals on scroll and shares the library's standardized hover-lift.
 * ----------------------------------------------------------------------------------------------- */

const columnClasses: Record<2 | 3 | 4, string> = {
  2: "md:grid-cols-2",
  3: "md:grid-cols-3",
  4: "md:grid-cols-4",
};

export interface BentoGridProps extends React.HTMLAttributes<HTMLDivElement> {
  /** Number of columns from the `md` breakpoint up. Cells stack to one column below it. */
  columns?: 2 | 3 | 4;
}

const BentoGrid = React.forwardRef<HTMLDivElement, BentoGridProps>(
  ({ className, columns = 3, ...props }, ref) => (
    <div
      ref={ref}
      className={cn(
        // auto-rows give every track a comfortable base height so `rowSpan={2}` reads as a tall
        // tile, while `minmax(…, auto)` lets dense content grow instead of clipping.
        "grid grid-cols-1 gap-4 md:auto-rows-[minmax(12rem,auto)]",
        columnClasses[columns],
        className
      )}
      {...props}
    />
  )
);
BentoGrid.displayName = "BentoGrid";

const colSpanClasses: Record<1 | 2 | 3, string> = {
  1: "",
  2: "md:col-span-2",
  3: "md:col-span-3",
};

const rowSpanClasses: Record<1 | 2, string> = {
  1: "",
  2: "md:row-span-2",
};

export interface BentoCardProps extends Omit<HTMLMotionProps<"div">, "title"> {
  /** Columns this tile spans from `md` up. */
  colSpan?: 1 | 2 | 3;
  /** Rows this tile spans from `md` up. */
  rowSpan?: 1 | 2;
  /** Optional leading icon shown in a soft badge. */
  icon?: LucideIcon;
  /** Optional heading. */
  title?: React.ReactNode;
  /** Optional supporting line under the heading. */
  description?: React.ReactNode;
}

const BentoCard = React.forwardRef<HTMLDivElement, BentoCardProps>(
  (
    { className, colSpan = 1, rowSpan = 1, icon: Icon, title, description, children, ...props },
    ref
  ) => (
    <motion.div
      ref={ref}
      className={cn(
        "group flex h-full flex-col overflow-hidden rounded-xl border border-border bg-card p-6 text-card-foreground shadow-soft transition-shadow duration-300 ease-out hover:shadow-lift",
        colSpanClasses[colSpan],
        rowSpanClasses[rowSpan],
        className
      )}
      variants={fadeUp}
      initial="hidden"
      whileInView="visible"
      viewport={viewportOnce}
      whileHover={interaction.cardHover}
      transition={spring.soft}
      {...props}
    >
      {Icon ? (
        <div className="mb-5 inline-flex size-11 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary">
          <Icon className="size-5" />
        </div>
      ) : null}
      {title ? (
        <h3 className="font-display text-lg font-semibold leading-tight tracking-tight">
          {title}
        </h3>
      ) : null}
      {description ? (
        <p className="mt-2 text-sm leading-relaxed text-muted-foreground">{description}</p>
      ) : null}
      {children as React.ReactNode}
    </motion.div>
  )
);
BentoCard.displayName = "BentoCard";

export { BentoGrid, BentoCard };

src/components/ui/bento-grid.tsx

Props

PropTypeDefaultDescription
BentoGrid columns2 | 3 | 43Columns from the md breakpoint up; tiles stack to one column below it.
BentoCard colSpan1 | 2 | 31Columns a tile spans (md+).
BentoCard rowSpan1 | 21Rows a tile spans (md+).
BentoCard iconLucideIcon—Optional leading icon in a soft badge.
BentoCard titleReactNode—Optional tile heading.
BentoCard descriptionReactNode—Optional supporting line under the heading.