{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "magic-bento",
  "title": "Magic Bento",
  "author": "AlgorizeTech",
  "description": "A bento grid whose cards light up and follow the pointer on hover. Use it for feature grids on a landing page.",
  "dependencies": [],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "src/components/custom/blocks/MagicBentoBlock.tsx",
      "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport React from \"react\";\nimport type { ReactNode } from \"react\";\n\n// ==========================================\n// BENTO GRID CONTAINER\n// ==========================================\nexport interface MagicBentoProps extends React.HTMLAttributes<HTMLDivElement> {\n  children: ReactNode;\n}\n\nexport const MagicBento = React.forwardRef<HTMLDivElement, MagicBentoProps>(\n  ({ children, className, ...props }, ref) => {\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          \"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 max-w-7xl mx-auto w-full auto-rows-[minmax(180px,auto)]\",\n          className,\n        )}\n        {...props}\n      >\n        {children}\n      </div>\n    );\n  },\n);\nMagicBento.displayName = \"MagicBento\";\n\n// ==========================================\n// BENTO CARD (With Magic Hover Effects)\n// ==========================================\nexport interface MagicBentoCardProps\n  extends React.HTMLAttributes<HTMLDivElement> {\n  children: ReactNode;\n  highlight?: boolean; // Activates the continuously spinning border\n}\n\n// Every glow reads from these two. They resolve on the card itself so the\n// component works with nothing but the shadcn theme, yet any ancestor can\n// still set `--magic-color` / `--magic-glow` to re-tint a whole grid.\nconst magicVars = {\n  \"--mb-color\": \"var(--magic-color, var(--primary, #6366f1))\",\n  \"--mb-glow\":\n    \"var(--magic-glow, color-mix(in srgb, var(--mb-color) 15%, transparent))\",\n} as React.CSSProperties;\n\nexport const MagicBentoCard = React.forwardRef<\n  HTMLDivElement,\n  MagicBentoCardProps\n>(({ children, className, highlight = false, style, ...props }, ref) => {\n  const spotlightRef = React.useRef<HTMLDivElement>(null);\n  const glowRef = React.useRef<HTMLDivElement>(null);\n\n  // Track mouse position relative to the card. It goes straight into the\n  // `--mb-x` / `--mb-y` variables of the two layers that read it — no React\n  // state, so a mouse move never re-renders.\n  function handleMouseMove({\n    currentTarget,\n    clientX,\n    clientY,\n  }: React.MouseEvent) {\n    const { left, top } = currentTarget.getBoundingClientRect();\n    for (const layer of [spotlightRef.current, glowRef.current]) {\n      layer?.style.setProperty(\"--mb-x\", `${clientX - left}px`);\n      layer?.style.setProperty(\"--mb-y\", `${clientY - top}px`);\n    }\n  }\n\n  return (\n    <div\n      ref={ref}\n      onMouseMove={handleMouseMove}\n      className={cn(\n        \"group relative flex flex-col overflow-hidden rounded-3xl bg-muted border border-transparent min-h-[200px] transition-transform duration-300 active:scale-[0.98]\",\n        className,\n      )}\n      style={{ ...magicVars, ...style }}\n      {...props}\n    >\n      {/* 1. Base Static Border */}\n      <div className=\"absolute inset-0 rounded-3xl bg-muted transition-colors\" />\n\n      {/* 2. Highlight: Continuously Spinning Conic Gradient */}\n      {highlight && (\n        <div className=\"absolute inset-[-100%] animate-[spin_4s_linear_infinite] bg-[conic-gradient(from_90deg_at_50%_50%,transparent_0%,var(--mb-color)_50%,transparent_100%)] opacity-70 dark:opacity-90 group-hover:opacity-100 transition-opacity duration-500\" />\n      )}\n\n      {/* 3. Hover: Mouse-Tracking Border Spotlight */}\n      <div\n        ref={spotlightRef}\n        className=\"absolute inset-0 rounded-3xl opacity-0 transition-opacity duration-300 group-hover:opacity-100\"\n        style={{\n          \"--mb-x\": \"0px\",\n          \"--mb-y\": \"0px\",\n          background: `radial-gradient(600px circle at var(--mb-x) var(--mb-y), var(--mb-color), transparent 40%)`,\n        } as React.CSSProperties}\n      />\n\n      {/* 4. Content Mask (Creates the 1px border effect) */}\n      <div className=\"absolute inset-[1px] rounded-[23px] bg-card transition-colors z-0\" />\n\n      {/* 5. Hover: Inner Card Soft Glow (FIXED: mix-blend-normal in light mode so white background can be tinted!) */}\n      <div\n        ref={glowRef}\n        className=\"absolute inset-0 z-10 opacity-0 transition-opacity duration-300 group-hover:opacity-100 pointer-events-none mix-blend-normal dark:mix-blend-screen\"\n        style={{\n          \"--mb-x\": \"0px\",\n          \"--mb-y\": \"0px\",\n          background: `radial-gradient(600px circle at var(--mb-x) var(--mb-y), var(--mb-glow), transparent 40%)`,\n        } as React.CSSProperties}\n      />\n\n      {/* 6. Actual Content Area */}\n      <div className=\"relative z-20 flex flex-col h-full p-6 sm:p-8 pointer-events-auto\">\n        {children}\n      </div>\n    </div>\n  );\n});\nMagicBentoCard.displayName = \"MagicBentoCard\";\n",
      "type": "registry:component",
      "target": "components/custom/blocks/MagicBentoBlock.tsx"
    }
  ],
  "docs": "Named exports: MagicBento, MagicBentoCard. Compose cards as children and set `highlight` on the ones that should stand out; span cards across columns with your own grid classes. Layout-agnostic — it supplies the effect, you supply the grid.",
  "categories": [
    "layout",
    "marketing"
  ],
  "type": "registry:component"
}
