{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "side-by-side",
  "type": "registry:ui",
  "title": "Side By Side",
  "description": "Two (or three) accounts of the same thing, set next to each other so the reader compares them line by line: what is said and what the record shows, before and after, one source and another. Columns stack on narrow screens, in source order, so the…",
  "author": "ofri-peretz <https://github.com/ofri-peretz>",
  "categories": [
    "blog",
    "pattern"
  ],
  "dependencies": [],
  "registryDependencies": [
    "https://ds.interlace.tools/r/interlace-base.json",
    "https://ds.interlace.tools/r/cn.json"
  ],
  "files": [
    {
      "path": "registry/interlace-ui/patterns/side-by-side.tsx",
      "target": "components/ui/patterns/side-by-side.tsx",
      "type": "registry:ui",
      "content": "import * as React from 'react';\n\n// @interlace/side-by-side v1.0.0 — Interlace design system.\n// Docs, props and live preview: https://ds.interlace.tools/c/side-by-side\n// What changed since: https://ds.interlace.tools/c/side-by-side#history\n// Generated banner — keep it, the upgrade diff reads this version.\n\n/**\n * @interlace/ui — SideBySide\n *\n * Two (or three) accounts of the same thing, set next to each other so the\n * reader compares them line by line: what is said and what the record shows,\n * before and after, one source and another. Columns stack on narrow screens,\n * in source order, so the comparison still reads top to bottom.\n *\n * ## Anatomy\n *\n *   SideBySide                        (div — grid, data-min-viewport=320)\n *     └─ SideBySideColumn × 2–3       (section, labelled by its title)\n *         ├─ title                    (h3 by default — with an optional tone bar)\n *         └─ children\n *\n * ## MIN_VIEWPORT — 320\n *\n * One column below `md`; two or three from `md` up.\n *\n * | Rule | Concept                          | Where in this file                                          |\n * | ---- | -------------------------------- | ----------------------------------------------------------- |\n * | R4   | Extends native el                | `div` / `section` props                                     |\n * | R6   | data-slot per part               | side-by-side / side-by-side-column                          |\n * | R7   | cn + ...rest                     | `cn(…, className)` + `{...props}`                           |\n * | R8   | Enums, not booleans              | `tone`, `as`                                                |\n * | R14  | Declares min viewport            | `data-min-viewport` on the root + exported const            |\n * | R19  | Tokens only                      | `bg-card`, tone tokens on the top border                    |\n * | R25  | Server component                 | Only `useId`, which RSC supports → no `'use client'`         |\n * | R26  | A11y from native el              | Each column is a `section` named by its heading (useId)     |\n */\n\nimport { cn } from '@/lib/utils';\n\nexport const MIN_VIEWPORT = 320 as const;\n\nexport type SideBySideTone = 'neutral' | 'success' | 'warning' | 'info' | 'destructive' | 'highlight';\n\nconst TONE_BORDER: Record<SideBySideTone, string> = {\n  neutral: 'border-t-border',\n  success: 'border-t-success',\n  warning: 'border-t-warning',\n  info: 'border-t-info',\n  destructive: 'border-t-destructive',\n  highlight: 'border-t-highlight',\n};\n\nfunction SideBySide({ className, ...props }: React.ComponentProps<'div'>) {\n  return (\n    <div\n      data-slot=\"side-by-side\"\n      data-min-viewport={String(MIN_VIEWPORT)}\n      className={cn('grid gap-4 md:auto-cols-fr md:grid-flow-col', className)}\n      {...props}\n    />\n  );\n}\n\ntype SideBySideColumnProps = Omit<React.ComponentProps<'section'>, 'title'> & {\n  /** The column heading: \"What you hear\", \"What the record shows\". */\n  title: React.ReactNode;\n  /** Colour of the bar above the column. Meaning lives in the title. @default 'neutral' */\n  tone?: SideBySideTone;\n  /** Heading level, to fit the page outline. @default 'h3' */\n  as?: 'h2' | 'h3' | 'h4';\n};\n\nfunction SideBySideColumn({\n  title,\n  tone = 'neutral',\n  as: Heading = 'h3',\n  className,\n  children,\n  ...props\n}: SideBySideColumnProps) {\n  const id = React.useId();\n  return (\n    <section\n      data-slot=\"side-by-side-column\"\n      aria-labelledby={id}\n      className={cn(\n        'bg-card text-card-foreground border-border space-y-3 rounded-xl border border-t-4 p-5',\n        TONE_BORDER[tone],\n        className,\n      )}\n      {...props}\n    >\n      <Heading id={id} className=\"text-lg font-semibold\">\n        {title}\n      </Heading>\n      <div className=\"space-y-3 text-sm leading-relaxed\">{children}</div>\n    </section>\n  );\n}\n\nconst SideBySideWithDot = Object.assign(SideBySide, { Column: SideBySideColumn });\n\nexport { SideBySideWithDot as SideBySide, SideBySideColumn };\nexport type { SideBySideColumnProps };\n"
    }
  ],
  "meta": {
    "tier": "pattern",
    "client": false,
    "minViewport": 320,
    "loading": false,
    "version": "1.0.0",
    "since": null
  },
  "docs": "## @interlace/side-by-side\n\nInstalled to `components/ui/patterns/side-by-side.tsx`.\n\n```tsx\nimport { /* … */ } from '@/components/ui/patterns/side-by-side';\n```\n\nProps, a11y contract, live preview and source: https://ds.interlace.tools/c/side-by-side\n\nRequires the `@interlace/interlace-base` CSS baseline (installed automatically as a registry dependency). For the Interlace look, also add `@interlace/theme`."
}
