Components/272cd450-6342-4d58-b214-f932a94b37f8

Bento Grid

featurefrom MagicUI Effects
Sign in to Add to Project
Bento Grid

AI Usage Rules

Use BentoGrid for feature showcases with asymmetric card layouts. Each BentoCard can span multiple columns using className="lg:col-span-2". Include an icon, name, description, and optional CTA link. Great for product feature pages.

Code Template

import { cn } from "@/lib/utils"

interface BentoGridProps extends React.ComponentProps<"div"> {}

export function BentoGrid({ children, className, ...props }: BentoGridProps) {
  return (
    <div className={cn("grid w-full auto-rows-[22rem] grid-cols-3 gap-4", className)} {...props}>
      {children}
    </div>
  )
}

interface BentoCardProps extends React.ComponentProps<"div"> {
  name: string
  description: string
  Icon: React.ElementType
  href?: string
  cta?: string
}

export function BentoCard({ name, className, description, Icon, href, cta, ...props }: BentoCardProps) {
  return (
    <div className={cn("group relative col-span-3 flex flex-col justify-between overflow-hidden rounded-xl bg-white [box-shadow:0_0_0_1px_rgba(0,0,0,.03),0_2px_4px_rgba(0,0,0,.05),0_12px_24px_rgba(0,0,0,.05)] transform-gpu dark:bg-black dark:[border:1px_solid_rgba(255,255,255,.1)] dark:[box-shadow:0_-20px_80px_-20px_#ffffff1f_inset] lg:col-span-1", className)} {...props}>
      <div className="pointer-events-none z-10 flex transform-gpu flex-col gap-1 p-6 transition-all duration-300 group-hover:-translate-y-10">
        <Icon className="h-12 w-12 origin-left transform-gpu text-neutral-700 transition-all duration-300 ease-in-out group-hover:scale-75" />
        <h3 className="text-xl font-semibold text-neutral-700 dark:text-neutral-300">{name}</h3>
        <p className="max-w-lg text-neutral-400">{description}</p>
      </div>
      <div className="pointer-events-none absolute bottom-0 flex w-full translate-y-10 transform-gpu flex-row items-center p-4 opacity-0 transition-all duration-300 group-hover:translate-y-0 group-hover:opacity-100">
        {href && <a href={href} className="pointer-events-auto inline-flex items-center gap-1 rounded-full border px-3 py-1.5 text-xs font-medium">{cta} →</a>}
      </div>
      <div className="pointer-events-none absolute inset-0 transform-gpu transition-all duration-300 group-hover:bg-black/[.03] group-hover:dark:bg-neutral-800/10" />
    </div>
  )
}

Props Schema

PropertyTypeDefaultDescription
cardsarray
View raw JSON schema
{
  "type": "object",
  "properties": {
    "cards": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "cta": {
            "type": "string"
          },
          "href": {
            "type": "string"
          },
          "icon": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      }
    }
  }
}