{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "split",
  "type": "registry:component",
  "title": "Split",
  "description": "Two columns, usually media beside text, that stack into one on a narrow width. A ratio between the columns and a reverse option.",
  "categories": [
    "layout"
  ],
  "dependencies": [],
  "registryDependencies": [
    "@rivier-ui/theme",
    "@rivier-ui/cn"
  ],
  "files": [
    {
      "path": "registry/layout/split.tsx",
      "type": "registry:component",
      "target": "components/layout/split.tsx",
      "content": "/**\n * @name split\n * @category layout\n * @description Two columns, usually media beside text, that stack into one on a narrow width. A ratio between the columns and a reverse option.\n * @when A feature row, a hero with an image, a form beside its explanation. Give it exactly two children. Alternate `reverse` down a page for a zigzag. For more than two columns use grid.\n * @example\n * <Split ratio=\"3:2\">\n *   <SplitMedia><img src=\"/shots/dashboard.png\" alt=\"The dashboard\" /></SplitMedia>\n *   <SplitContent>\n *     <h2 className=\"text-3xl font-medium\">See everything at once</h2>\n *     <p className=\"text-muted-foreground\">One screen for the whole week.</p>\n *   </SplitContent>\n * </Split>\n * <Split reverse align=\"start\" gap=\"lg\">\n *   <SplitMedia>…</SplitMedia>\n *   <SplitContent>…</SplitContent>\n * </Split>\n */\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\n/* Columns appear when the split itself is 48rem wide or more (a container query, not the viewport). */\nconst RATIO = {\n  \"1:1\": \"@3xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]\",\n  \"1:2\": \"@3xl:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]\",\n  \"2:1\": \"@3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]\",\n  \"2:3\": \"@3xl:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]\",\n  \"3:2\": \"@3xl:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]\",\n} as const;\n\nconst GAP = {\n  sm: \"gap-6 @3xl:gap-8\",\n  md: \"gap-8 @3xl:gap-12\",\n  lg: \"gap-10 @3xl:gap-20\",\n} as const;\n\nconst ALIGN = {\n  start: \"items-start\",\n  center: \"items-center\",\n  end: \"items-end\",\n  stretch: \"items-stretch\",\n} as const;\n\nexport type SplitProps = ComponentProps<\"div\"> & {\n  /** First column to second column, in source order. Defaults to \"1:1\". */\n  ratio?: keyof typeof RATIO;\n  /** Side by side, show the first child second. Stacked, the source order is kept. The ratio follows the children: \"3:2\" with `reverse` puts the wide column last. */\n  reverse?: boolean;\n  /** How the two columns line up vertically. Defaults to \"center\". */\n  align?: keyof typeof ALIGN;\n  /** Space between the columns. Defaults to \"md\". */\n  gap?: keyof typeof GAP;\n};\n\nconst REVERSED = {\n  \"1:1\": RATIO[\"1:1\"],\n  \"1:2\": RATIO[\"2:1\"],\n  \"2:1\": RATIO[\"1:2\"],\n  \"2:3\": RATIO[\"3:2\"],\n  \"3:2\": RATIO[\"2:3\"],\n} as const;\n\nexport function Split({ className, ratio = \"1:1\", reverse = false, align = \"center\", gap = \"md\", children, ...props }: SplitProps) {\n  return (\n    <div data-slot=\"split\" className={cn(\"@container w-full\", className)} {...props}>\n      <div\n        data-slot=\"split-track\"\n        className={cn(\"grid grid-cols-1\", reverse ? REVERSED[ratio] : RATIO[ratio], GAP[gap], ALIGN[align], reverse && \"@3xl:[&>*:first-child]:order-last\")}\n      >\n        {children}\n      </div>\n    </div>\n  );\n}\n\n/** The picture side. A direct img or video child fills it; the corners follow the theme's surface radius. */\nexport function SplitMedia({ className, ...props }: ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"split-media\"\n      className={cn(\"min-w-0 overflow-hidden rounded-surface [&>img]:h-auto [&>img]:w-full [&>img]:object-cover [&>video]:h-auto [&>video]:w-full [&>video]:object-cover\", className)}\n      {...props}\n    />\n  );\n}\n\n/** The text side: a column with even spacing. */\nexport function SplitContent({ className, ...props }: ComponentProps<\"div\">) {\n  return <div data-slot=\"split-content\" className={cn(\"flex min-w-0 flex-col gap-4\", className)} {...props} />;\n}\n"
    }
  ],
  "meta": {
    "category": "layout",
    "when": "A feature row, a hero with an image, a form beside its explanation. Give it exactly two children. Alternate `reverse` down a page for a zigzag. For more than two columns use grid.",
    "example": "<Split ratio=\"3:2\">\n  <SplitMedia><img src=\"/shots/dashboard.png\" alt=\"The dashboard\" /></SplitMedia>\n  <SplitContent>\n    <h2 className=\"text-3xl font-medium\">See everything at once</h2>\n    <p className=\"text-muted-foreground\">One screen for the whole week.</p>\n  </SplitContent>\n</Split>\n<Split reverse align=\"start\" gap=\"lg\">\n  <SplitMedia>…</SplitMedia>\n  <SplitContent>…</SplitContent>\n</Split>",
    "client": false
  }
}
