{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bento-hover-expand",
  "type": "registry:component",
  "title": "Bento Hover Expand",
  "description": "A six-tile bento whose grid tracks resize around the tile you hover or focus. The opened tile widens and grows to reveal an animated visual, details and a stat while its neighbours compress.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "bento",
    "bento",
    "hover",
    "expand",
    "grid",
    "database",
    "developer"
  ],
  "docs": "https://hyperblur.dev/effects/bento-hover-expand",
  "files": [
    {
      "path": "registry/hyperblur/bento-hover-expand.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/bento-hover-expand.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface BentoHoverExpandTile {\n  title: string;\n  summary: string;\n  points: string[];\n  stat: string;\n}\n\nexport interface BentoHoverExpandProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  tiles?: BentoHoverExpandTile[];\n  defaultIndex?: number;\n  onItemSelect?: (index: number) => void;\n  accent?: string;\n}\n\nconst css = `\n@keyframes hb-wa9-rise { from { opacity: 0; transform: translate3d(0, 14px, 0); } to { opacity: 1; transform: none; } }\n@keyframes hb-wa9-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }\n@keyframes hb-wa9-scrub { 0%, 100% { left: 18%; } 50% { left: 72%; } }\n@keyframes hb-wa9-pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(4); opacity: 0; } }\n@keyframes hb-wa9-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }\n@keyframes hb-wa9-in { from { opacity: 0; transform: translate3d(0, 10px, 0); } to { opacity: 1; transform: none; } }\n.hb-wa9 {\n  --hb-wa9-accent: #f59e0b;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-wa9 *, .hb-wa9 *::before, .hb-wa9 *::after { box-sizing: border-box; }\n.hb-wa9 em, .hb-wa9 i { font-style: normal; }\n.hb-wa9-in { max-width: 1120px; margin: 0 auto; padding: clamp(56px, 8cqi, 104px) clamp(16px, 5cqi, 48px); }\n.hb-wa9-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 40px; flex-wrap: wrap; margin-bottom: clamp(24px, 3.6cqi, 40px); }\n.hb-wa9-eyebrow { margin: 0 0 12px; color: var(--hb-wa9-accent); font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; }\n.hb-wa9-title { margin: 0; max-width: 600px; font-size: clamp(28px, 4.2cqi, 46px); font-weight: 600; line-height: 1.06; letter-spacing: -.035em; text-wrap: balance; }\n.hb-wa9-sub { margin: 0; max-width: 360px; color: #8f8f8f; font-size: 15px; line-height: 1.6; }\n.hb-wa9-grid { display: grid; grid-template-columns: var(--hb-wa9-cols); grid-template-rows: var(--hb-wa9-rows); height: 540px; gap: 12px; transition: grid-template-columns .6s cubic-bezier(.22, 1, .36, 1), grid-template-rows .6s cubic-bezier(.22, 1, .36, 1); }\n.hb-wa9-tile { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; padding: 18px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 20px; background: linear-gradient(180deg, #131313, #0e0e0e); color: inherit; font: inherit; text-align: left; cursor: pointer; animation: hb-wa9-rise .7s cubic-bezier(.22, 1, .36, 1) backwards; animation-delay: calc(var(--i) * 70ms); transition: border-color .3s ease, background .3s ease; }\n.hb-wa9-tile::before { content: \"\"; position: absolute; inset: 0; background: radial-gradient(80% 70% at 100% 0%, color-mix(in srgb, var(--hb-wa9-accent) 16%, transparent), transparent 70%); opacity: 0; transition: opacity .5s ease; pointer-events: none; }\n.hb-wa9-tile[aria-expanded=\"true\"] { border-color: color-mix(in srgb, var(--hb-wa9-accent) 40%, transparent); }\n.hb-wa9-tile[aria-expanded=\"true\"]::before { opacity: 1; }\n.hb-wa9-tile:focus-visible { outline: 2px solid var(--hb-wa9-accent); outline-offset: 3px; }\n.hb-wa9-top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; }\n.hb-wa9-n { color: #5f5f5f; font-family: var(--font-mono, ui-monospace, monospace); font-size: 11px; }\n.hb-wa9-plus { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 50%; color: #a1a1a1; transition: transform .5s cubic-bezier(.22, 1, .36, 1), background .3s ease, color .3s ease; }\n.hb-wa9-tile[aria-expanded=\"true\"] .hb-wa9-plus { transform: rotate(45deg); background: var(--hb-wa9-accent); border-color: transparent; color: #140d00; }\n.hb-wa9-tile h3 { position: relative; margin: auto 0 0; padding-top: 14px; font-size: clamp(16px, 1.8cqi, 20px); font-weight: 600; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-wa9-sum { position: relative; margin: 4px 0 0; color: #8f8f8f; font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n.hb-wa9-more { position: relative; display: none; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; flex: 1; min-height: 0; margin-top: 14px; }\n.hb-wa9-tile[aria-expanded=\"true\"] .hb-wa9-more { display: grid; animation: hb-wa9-in .5s cubic-bezier(.22, 1, .36, 1) .15s both; }\n.hb-wa9-tile[aria-expanded=\"true\"] h3 { margin-top: 0; }\n.hb-wa9-vis { position: relative; min-height: 0; overflow: hidden; border: 1px solid rgba(255, 255, 255, .06); border-radius: 14px; background: #0a0a0a; }\n.hb-wa9-pts { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: #cfcfcf; }\n.hb-wa9-pts li { display: flex; gap: 8px; line-height: 1.45; }\n.hb-wa9-pts li::before { content: \"\"; flex: none; width: 6px; height: 6px; margin-top: 6px; border-radius: 2px; background: var(--hb-wa9-accent); transform: rotate(45deg); }\n.hb-wa9-stat { margin-top: auto; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .08); color: #8f8f8f; font-size: 12px; }\n.hb-wa9-stat b { display: block; color: #ededed; font-family: var(--font-grotesk, inherit); font-size: 22px; font-weight: 600; letter-spacing: -.02em; }\n.hb-wa9-svg { position: absolute; inset: 0; width: 100%; height: 100%; }\n.hb-wa9-svg path { fill: none; stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; animation: hb-wa9-draw 1s cubic-bezier(.22, 1, .36, 1) both; }\n.hb-wa9-svg circle.hb-wa9-pul { fill: none; stroke: var(--hb-wa9-accent); transform-box: fill-box; transform-origin: center; animation: hb-wa9-pulse 1.8s ease-out infinite; }\n.hb-wa9-tl { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: #262626; }\n.hb-wa9-tl i { position: absolute; top: -4px; width: 2px; height: 10px; background: #3a3a3a; }\n.hb-wa9-scr { position: absolute; top: calc(50% - 22px); width: 2px; height: 44px; margin-left: -1px; background: var(--hb-wa9-accent); animation: hb-wa9-scrub 5s cubic-bezier(.65, 0, .35, 1) infinite; }\n.hb-wa9-scr span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px; padding: 2px 6px; border-radius: 6px; background: var(--hb-wa9-accent); color: #140d00; font-family: var(--font-mono, ui-monospace, monospace); font-size: 10px; white-space: nowrap; }\n.hb-wa9-qs { position: absolute; inset: 12px; display: flex; flex-direction: column; justify-content: center; gap: 9px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 10.5px; color: #a1a1a1; }\n.hb-wa9-qs div { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; align-items: center; }\n.hb-wa9-qs div > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.hb-wa9-qs i { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--hb-wa9-accent), color-mix(in srgb, var(--hb-wa9-accent) 30%, #111)); width: var(--w); transform-origin: left; animation: hb-wa9-bar .8s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(var(--j) * 100ms + 200ms); }\n.hb-wa9-diff { position: absolute; inset: 12px; display: flex; flex-direction: column; justify-content: center; gap: 3px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 10.5px; white-space: nowrap; overflow: hidden; }\n.hb-wa9-diff span { padding: 2px 6px; border-radius: 4px; color: #8f8f8f; }\n.hb-wa9-diff span[data-k=\"+\"] { background: rgba(34, 197, 94, .12); color: #86efac; }\n.hb-wa9-diff span[data-k=\"-\"] { background: rgba(244, 63, 94, .1); color: #fda4af; }\n.hb-wa9-hit { position: absolute; inset: 14px; display: flex; flex-direction: column; justify-content: center; gap: 10px; }\n.hb-wa9-hit strong { font-family: var(--font-grotesk, inherit); font-size: 34px; font-weight: 600; letter-spacing: -.04em; }\n.hb-wa9-hit small { color: #8f8f8f; font-size: 11px; }\n.hb-wa9-hbar { display: flex; height: 10px; overflow: hidden; border-radius: 5px; }\n.hb-wa9-hbar i { height: 100%; transform-origin: left; animation: hb-wa9-bar .9s cubic-bezier(.22, 1, .36, 1) both; }\n@container (max-width: 720px) {\n  .hb-wa9-grid { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: none !important; height: auto; }\n  .hb-wa9-tile[aria-expanded=\"true\"] .hb-wa9-more { grid-template-columns: minmax(0, 1fr); }\n  .hb-wa9-vis { height: 150px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-wa9 *, .hb-wa9 *::before, .hb-wa9 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nconst defaultTiles: BentoHoverExpandTile[] = [\n  { title: \"Branch the database\", summary: \"A full copy of production for every pull request, in two seconds.\", points: [\"Copy-on-write, so branches cost nothing until they change\", \"Auto-deleted when the PR merges\"], stat: \"2.1s to branch 480 GB\" },\n  { title: \"Point-in-time restore\", summary: \"Rewind to any second in the last 30 days.\", points: [\"Restore to a new branch, never over production\", \"Diff the restored rows before you swap\"], stat: \"30 days of second-level history\" },\n  { title: \"Read replicas\", summary: \"Serve reads from the region closest to each user.\", points: [\"Add a region with one command\", \"Replica lag shown live per query\"], stat: \"11 regions, p50 lag 38 ms\" },\n  { title: \"Edge cache\", summary: \"Repeat queries answered before they reach the database.\", points: [\"Invalidated automatically on write\", \"Per-table rules, no code changes\"], stat: \"94% hit ratio on reads\" },\n  { title: \"Query insights\", summary: \"The five queries costing you the most, ranked.\", points: [\"Suggested indexes with expected gain\", \"One click to test on a branch\"], stat: \"3.4x faster median query\" },\n  { title: \"Schema diff\", summary: \"Review migrations like code, with a safe deploy.\", points: [\"Blocks locking migrations at peak\", \"A rollback plan ships with every change\"], stat: \"Zero-downtime migrations, every time\" },\n];\n\nfunction VisBranch() {\n  return (\n    <svg className=\"hb-wa9-svg\" viewBox=\"0 0 200 120\" preserveAspectRatio=\"none\" aria-hidden=\"true\">\n      <path d=\"M10 80 H190\" stroke=\"#3a3a3a\" pathLength={1} />\n      <path d=\"M40 80 C 60 80, 60 40, 90 40 H 150 C 170 40, 170 80, 186 80\" stroke=\"var(--hb-wa9-accent)\" pathLength={1} style={{ animationDelay: \".2s\" }} />\n      <path d=\"M100 80 C 115 80, 115 104, 140 104 H 170\" stroke=\"#60a5fa\" pathLength={1} style={{ animationDelay: \".5s\" }} />\n      <circle cx=\"40\" cy=\"80\" r=\"4\" fill=\"#ededed\" />\n      <circle cx=\"150\" cy=\"40\" r=\"4\" fill=\"var(--hb-wa9-accent)\" />\n      <circle className=\"hb-wa9-pul\" cx=\"150\" cy=\"40\" r=\"3\" />\n      <circle cx=\"170\" cy=\"104\" r=\"4\" fill=\"#60a5fa\" />\n    </svg>\n  );\n}\n\nfunction VisRestore() {\n  return (\n    <>\n      <div className=\"hb-wa9-tl\">\n        {[0, 20, 40, 60, 80, 100].map((l) => (\n          <i key={l} style={{ left: `${l}%` }} />\n        ))}\n      </div>\n      <i className=\"hb-wa9-scr\"><span>Oct 29 14:02:17</span></i>\n    </>\n  );\n}\n\nfunction VisReplicas() {\n  const nodes = [[100, 60], [40, 34], [160, 30], [52, 96], [150, 94]];\n  return (\n    <svg className=\"hb-wa9-svg\" viewBox=\"0 0 200 120\" preserveAspectRatio=\"xMidYMid meet\" aria-hidden=\"true\">\n      {nodes.slice(1).map(([x, y], j) => (\n        <path key={j} d={`M100 60 L${x} ${y}`} stroke=\"color-mix(in srgb, var(--hb-wa9-accent) 60%, #333)\" pathLength={1} style={{ animationDelay: `${j * 0.12}s` }} />\n      ))}\n      {nodes.map(([x, y], j) => (\n        <g key={j}>\n          {j > 0 && <circle className=\"hb-wa9-pul\" cx={x} cy={y} r=\"3\" style={{ animationDelay: `${j * 0.3}s` }} />}\n          <circle cx={x} cy={y} r={j === 0 ? 8 : 5} fill={j === 0 ? \"var(--hb-wa9-accent)\" : \"#ededed\"} />\n        </g>\n      ))}\n    </svg>\n  );\n}\n\nfunction VisCache() {\n  return (\n    <div className=\"hb-wa9-hit\">\n      <strong>94.2%</strong>\n      <div className=\"hb-wa9-hbar\">\n        <i style={{ width: \"94.2%\", background: \"var(--hb-wa9-accent)\" }} />\n        <i style={{ width: \"5.8%\", background: \"#333\", animationDelay: \".3s\" }} />\n      </div>\n      <small>12.8M cached of 13.6M reads today</small>\n    </div>\n  );\n}\n\nfunction VisInsights() {\n  const q = [[\"SELECT * FROM orders WHERE…\", \"412ms\", 92], [\"UPDATE sessions SET…\", \"188ms\", 54], [\"SELECT count(*) FROM events…\", \"121ms\", 36]];\n  return (\n    <div className=\"hb-wa9-qs\">\n      {q.map(([t, ms, w], j) => (\n        <div key={String(t)}>\n          <span>{t}</span>\n          <span>{ms}</span>\n          <i style={{ \"--w\": `${w}%`, \"--j\": j } as React.CSSProperties} />\n        </div>\n      ))}\n    </div>\n  );\n}\n\nfunction VisDiff() {\n  return (\n    <div className=\"hb-wa9-diff\">\n      <span>  table users (</span>\n      <span>    id uuid primary key,</span>\n      <span data-k=\"-\">-   name text,</span>\n      <span data-k=\"+\">+   first_name text not null,</span>\n      <span data-k=\"+\">+   last_name text not null,</span>\n      <span>  )</span>\n    </div>\n  );\n}\n\nconst visuals = [VisBranch, VisRestore, VisReplicas, VisCache, VisInsights, VisDiff];\n\nexport function BentoHoverExpand({\n  eyebrow = \"quarry / platform\",\n  title = \"Postgres with the sharp edges filed off\",\n  subtitle = \"Hover any tile to open it. The grid makes room, the rest step aside.\",\n  tiles = defaultTiles,\n  defaultIndex = 0,\n  onItemSelect,\n  accent = \"#f59e0b\",\n  className,\n  style,\n  ...rest\n}: BentoHoverExpandProps) {\n  const [active, setActive] = React.useState(defaultIndex);\n  const list = tiles.slice(0, 6);\n  const cols = 3;\n  const rowsN = Math.ceil(list.length / cols);\n  const ac = active % cols;\n  const ar = Math.floor(active / cols);\n  const colTpl = Array.from({ length: cols }, (_, c) => (c === ac ? \"2.3fr\" : \"1fr\")).join(\" \");\n  const rowTpl = Array.from({ length: rowsN }, (_, r) => (r === ar ? \"1.7fr\" : \"1fr\")).join(\" \");\n\n  const pick = (i: number) => {\n    if (i === active) return;\n    setActive(i);\n    onItemSelect?.(i);\n  };\n\n  return (\n    <section className={[\"hb-wa9\", className].filter(Boolean).join(\" \")} style={{ \"--hb-wa9-accent\": accent, ...style } as React.CSSProperties} {...rest}>\n      <style href=\"hb-bento-hover-expand\" precedence=\"default\">{css}</style>\n      <div className=\"hb-wa9-in\">\n        <div className=\"hb-wa9-head\">\n          <div>\n            <p className=\"hb-wa9-eyebrow\">{eyebrow}</p>\n            <h2 className=\"hb-wa9-title\">{title}</h2>\n          </div>\n          <p className=\"hb-wa9-sub\">{subtitle}</p>\n        </div>\n        <div className=\"hb-wa9-grid\" style={{ \"--hb-wa9-cols\": colTpl, \"--hb-wa9-rows\": rowTpl } as React.CSSProperties}>\n          {list.map((t, i) => {\n            const Vis = visuals[i % visuals.length];\n            const open = i === active;\n            return (\n              <div\n                key={t.title}\n                role=\"button\"\n                tabIndex={0}\n                className=\"hb-wa9-tile\"\n                aria-expanded={open}\n                style={{ \"--i\": i } as React.CSSProperties}\n                onPointerEnter={() => pick(i)}\n                onFocus={() => pick(i)}\n                onClick={() => pick(i)}\n                onKeyDown={(e) => {\n                  if (e.key === \"Enter\" || e.key === \" \") {\n                    e.preventDefault();\n                    pick(i);\n                  }\n                }}\n              >\n                <div className=\"hb-wa9-top\">\n                  <span className=\"hb-wa9-n\">{String(i + 1).padStart(2, \"0\")}</span>\n                  <span className=\"hb-wa9-plus\" aria-hidden=\"true\">\n                    <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\"><path d=\"M6 1v10M1 6h10\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" /></svg>\n                  </span>\n                </div>\n                <h3>{t.title}</h3>\n                <p className=\"hb-wa9-sum\">{t.summary}</p>\n                {open && (\n                  <div className=\"hb-wa9-more\">\n                    <div className=\"hb-wa9-vis\">\n                      <Vis />\n                    </div>\n                    <div style={{ display: \"flex\", flexDirection: \"column\", minHeight: 0 }}>\n                      <ul className=\"hb-wa9-pts\">\n                        {t.points.map((p) => (\n                          <li key={p}>{p}</li>\n                        ))}\n                      </ul>\n                      <div className=\"hb-wa9-stat\">\n                        <b>{t.stat.split(/ (.+)/)[0]}</b>\n                        {t.stat.split(/ (.+)/)[1]}\n                      </div>\n                    </div>\n                  </div>\n                )}\n              </div>\n            );\n          })}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}