{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bento-grid",
  "type": "registry:block",
  "title": "Bento grid",
  "description": "Feature tiles in mixed sizes. Tiles are placed in the order you give, so reading order matches what you see.",
  "categories": [
    "section"
  ],
  "registryDependencies": [
    "https://facadeui.dev/r/container.json",
    "https://facadeui.dev/r/feature-icon.json",
    "https://facadeui.dev/r/heading.json",
    "https://facadeui.dev/r/section.json",
    "https://facadeui.dev/r/section-header.json",
    "https://facadeui.dev/r/types.json",
    "https://facadeui.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "src/sections/bento-grid.tsx",
      "type": "registry:component",
      "target": "components/sections/bento-grid.tsx",
      "content": "/**\n * BentoGrid — a mosaic of feature tiles at mixed sizes.\n *\n * Each item declares how much room it wants (`span`), and the grid resolves that\n * into column and row spans at `sm` and up. Below `sm` everything stacks: a\n * bento layout at phone width is just a list, and pretending otherwise produces\n * unreadable tiles.\n *\n * a11y: a `<ul>` whose visual order matches DOM order — no `grid-auto-flow:\n * dense`, and no manual `order`. Dense packing reorders tiles visually without\n * touching the DOM, which is exactly the mismatch between reading order and\n * visual order that WCAG 1.3.2 exists to prevent. Tiles are laid out in the\n * order they are given; to change the mosaic, change the array.\n *\n * Clickable tiles use the same stretched-link pattern as FeatureGrid, so the\n * accessible name stays the tile's title rather than its whole body.\n *\n * Dependencies: react, @/lib/types, @/lib/utils,\n * @/components/ui/container, @/components/ui/feature-icon, @/components/ui/heading,\n * @/components/ui/section, @/components/ui/section-header.\n */\n\nimport type { ElementType, ReactNode } from \"react\"\n\nimport type {\n  HeadingLevel,\n  IconComponent,\n  LinkComponent,\n  ListSlotProps,\n  SectionBaseProps,\n} from \"@/lib/types\"\nimport { cn, slugId } from \"@/lib/utils\"\nimport { Container } from \"@/components/ui/container\"\nimport { FeatureIcon } from \"@/components/ui/feature-icon\"\nimport { Heading } from \"@/components/ui/heading\"\nimport { Section } from \"@/components/ui/section\"\nimport { SectionHeader } from \"@/components/ui/section-header\"\n\n/** How much of the mosaic a tile occupies at `sm` and above. */\nexport type BentoSpan = \"sm\" | \"md\" | \"lg\" | \"tall\" | \"wide\"\n\nexport interface BentoItem {\n  title: string\n  description?: string\n  icon?: IconComponent\n  span?: BentoSpan\n  /** Rendered inside the tile, under the copy. A screenshot, a chart, a list. */\n  media?: ReactNode\n  href?: string\n  external?: boolean\n  id?: string\n}\n\nexport interface BentoGridProps extends SectionBaseProps, ListSlotProps {\n  items: BentoItem[]\n  title?: string\n  eyebrow?: string\n  description?: string\n  link?: LinkComponent\n  itemHeadingLevel?: HeadingLevel\n  align?: \"start\" | \"center\"\n}\n\n/** The grid is six columns at `sm`; spans are expressed against that. */\nconst spans: Record<BentoSpan, string> = {\n  sm: \"sm:col-span-2\",\n  md: \"sm:col-span-3\",\n  lg: \"sm:col-span-4\",\n  wide: \"sm:col-span-6\",\n  tall: \"sm:col-span-2 sm:row-span-2\",\n}\n\nexport function BentoGrid({\n  items,\n  title,\n  eyebrow,\n  description,\n  link,\n  itemHeadingLevel,\n  align = \"start\",\n  listAs,\n  itemAs,\n  headingLevel = 2,\n  as,\n  spacing = \"md\",\n  className,\n  id,\n}: BentoGridProps) {\n  const List = (listAs ?? \"ul\") as ElementType\n  const Item = (itemAs ?? \"li\") as ElementType\n  const Link = (link ?? \"a\") as ElementType\n  const titleId = title ? (id ? `${id}-title` : slugId(title)) : undefined\n  const itemLevel = itemHeadingLevel ?? (Math.min(headingLevel + 1, 6) as HeadingLevel)\n\n  return (\n    <Section\n      as={as ?? (title ? \"section\" : \"div\")}\n      spacing={spacing}\n      labelledBy={titleId}\n      id={id}\n      className={className}\n    >\n      <Container className=\"flex flex-col gap-14\">\n        {title ? (\n          <SectionHeader\n            align={align}\n            eyebrow={eyebrow}\n            title={title}\n            description={description}\n            headingLevel={headingLevel}\n            titleId={titleId}\n          />\n        ) : null}\n\n        <List className=\"grid auto-rows-[minmax(11rem,auto)] grid-cols-1 gap-4 sm:grid-cols-6\">\n          {items.map((item) => (\n            <Item\n              key={item.id ?? item.title}\n              className={cn(\n                \"bg-card text-card-foreground relative flex flex-col gap-3 overflow-hidden rounded-xl border p-6\",\n                spans[item.span ?? \"md\"],\n                item.href &&\n                  \"duration-facade-fast ease-facade-out hover:border-ring has-[a:focus-visible]:ring-ring has-[a:focus-visible]:ring-offset-background transition-colors has-[a:focus-visible]:ring-2 has-[a:focus-visible]:ring-offset-2\",\n              )}\n            >\n              {item.icon ? <FeatureIcon icon={item.icon} size=\"sm\" /> : null}\n\n              <Heading\n                level={itemLevel}\n                className=\"text-foreground text-balance font-semibold\"\n              >\n                {item.href ? (\n                  <Link\n                    href={item.href}\n                    {...(item.external\n                      ? { target: \"_blank\", rel: \"noopener noreferrer\" }\n                      : {})}\n                    className=\"outline-none after:absolute after:inset-0 after:content-['']\"\n                  >\n                    {item.title}\n                    {item.external ? (\n                      <span className=\"sr-only\"> (opens in a new tab)</span>\n                    ) : null}\n                  </Link>\n                ) : (\n                  item.title\n                )}\n              </Heading>\n\n              {item.description ? (\n                <p className=\"text-muted-foreground text-pretty text-sm\">\n                  {item.description}\n                </p>\n              ) : null}\n\n              {item.media ? (\n                <div className=\"mt-auto min-w-0 pt-2\">{item.media}</div>\n              ) : null}\n            </Item>\n          ))}\n        </List>\n      </Container>\n    </Section>\n  )\n}\n"
    }
  ],
  "docs": "Import styles/facade-tokens.css in your global stylesheet, after @import \"tailwindcss\". Set headingLevel to fit the page outline (sections default to h2). Pass next/link and next/image through the link and image props. Docs: https://facadeui.dev/components/bento-grid"
}
