{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "versus-table",
  "type": "registry:block",
  "title": "Versus Table",
  "description": "An us-versus-the-old-way comparison with one raised, highlighted column, ticks that pop in as you scroll, a header that sticks, and a phone layout that compares against one rival at a time.",
  "categories": [
    "block",
    "Marketing"
  ],
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "https://coss.com/ui/r/button.json"
  ],
  "files": [
    {
      "path": "registry/devl/versus-table.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport { ArrowRightIcon, CheckIcon, XIcon } from \"lucide-react\";\nimport { motion, MotionConfig, useReducedMotion } from \"motion/react\";\nimport { type CSSProperties, Fragment, type ReactNode, useEffect, useId, useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\n\nfunction useReducedMotionSafe() {\n  const prefers = useReducedMotion();\n  const [mounted, setMounted] = useState(false);\n  useEffect(() => setMounted(true), []);\n  return mounted && Boolean(prefers);\n}\n\nexport type VersusValue = boolean | string;\n\nexport interface VersusColumn {\n  id: string;\n  name: string;\n  note?: string;\n}\n\nexport interface VersusGroup {\n  name: string;\n  rows: { label: string; hint?: string; values: Record<string, VersusValue> }[];\n}\n\nexport interface VersusTableProps {\n  eyebrow?: string;\n  title: ReactNode;\n  description?: ReactNode;\n  us: VersusColumn & { mark?: ReactNode };\n  them: VersusColumn[];\n  groups: VersusGroup[];\n  cta?: { label: string; href: string };\n  className?: string;\n}\n\nconst ease = [0.23, 1, 0.32, 1] as const;\n\nfunction Value({ value, ours, index }: { value: VersusValue | undefined; ours: boolean; index: number }) {\n  if (value === true) {\n    return (\n      <motion.span\n        className={cn(\n          \"inline-flex size-5 items-center justify-center rounded-full\",\n          ours ? \"bg-primary text-primary-foreground\" : \"bg-foreground/8 text-foreground/70\",\n        )}\n        initial={{ opacity: 0, scale: 0.8 }}\n        transition={{ type: \"spring\", stiffness: 520, damping: 30, delay: Math.min(index, 14) * 0.03 }}\n        viewport={{ once: true, amount: 0.5 }}\n        whileInView={{ opacity: 1, scale: 1 }}\n      >\n        <CheckIcon aria-hidden className=\"size-3\" strokeWidth={3} />\n        <span className=\"sr-only\">Yes</span>\n      </motion.span>\n    );\n  }\n  if (value === false || value === undefined) {\n    return (\n      <span className=\"inline-flex size-5 items-center justify-center text-muted-foreground/50\">\n        <XIcon aria-hidden className=\"size-3.5\" strokeWidth={2.5} />\n        <span className=\"sr-only\">No</span>\n      </span>\n    );\n  }\n  return (\n    <span className={cn(\"text-balance text-xs leading-snug\", ours ? \"font-medium text-foreground\" : \"text-muted-foreground\")}>\n      {value}\n    </span>\n  );\n}\n\nexport function VersusTable({ eyebrow, title, description, us, them, groups, cta, className }: VersusTableProps) {\n  const reduce = useReducedMotionSafe();\n  const [compare, setCompare] = useState(them[0]?.id);\n  const pillId = useId();\n  const columns = [us, ...them];\n  const hiddenOnPhone = (id: string) => id !== us.id && id !== compare;\n  const cell = (id: string) =>\n    cn(\"[grid-column:var(--cm)] sm:[grid-column:var(--c)]\", hiddenOnPhone(id) && \"max-sm:hidden\");\n  // Every cell gets an explicit row and column so the raised card can sit behind one column.\n  const place = (id: string, row: number) =>\n    ({ \"--c\": columns.findIndex((c) => c.id === id) + 2, \"--cm\": id === us.id ? 2 : 3, gridRow: row }) as CSSProperties;\n  const totalRows = 1 + groups.reduce((n, g) => n + 1 + g.rows.length, 0) + (cta ? 1 : 0);\n  let tick = 0;\n  let r = 1;\n\n  return (\n    <MotionConfig reducedMotion=\"user\">\n      <section className={cn(\"mx-auto w-full max-w-[1100px]\", className)}>\n        <header className=\"mx-auto flex max-w-xl flex-col items-center text-center\">\n          {eyebrow && <p className=\"font-medium text-muted-foreground text-xs uppercase tracking-widest\">{eyebrow}</p>}\n          <h2 className=\"mt-2 text-balance font-heading font-semibold text-3xl tracking-tight sm:text-4xl\">{title}</h2>\n          {description && (\n            <p className=\"mt-3 text-balance text-muted-foreground text-sm leading-relaxed sm:text-base\">{description}</p>\n          )}\n        </header>\n\n        {them.length > 1 && (\n          <div className=\"mt-8 flex items-center justify-center gap-2 sm:hidden\">\n            <span className=\"text-muted-foreground text-xs\">Compare with</span>\n            <div className=\"relative flex rounded-full border bg-muted p-0.5\" role=\"radiogroup\" aria-label=\"Compare with\">\n              {them.map((col) => {\n                const on = compare === col.id;\n                return (\n                  <button\n                    aria-checked={on}\n                    className={cn(\n                      \"relative h-8 cursor-pointer rounded-full px-3 font-medium text-xs outline-none transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-ring\",\n                      on ? \"text-foreground\" : \"text-muted-foreground\",\n                    )}\n                    key={col.id}\n                    onClick={() => setCompare(col.id)}\n                    role=\"radio\"\n                    type=\"button\"\n                  >\n                    {on && (\n                      <motion.span\n                        className=\"absolute inset-0 -z-0 rounded-full bg-background shadow-xs/5 dark:bg-input\"\n                        layoutId={pillId}\n                        transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 40 }}\n                      />\n                    )}\n                    <span className=\"relative\">{col.name}</span>\n                  </button>\n                );\n              })}\n            </div>\n          </div>\n        )}\n\n        <div\n          className=\"relative mt-6 grid grid-cols-[minmax(0,1fr)_repeat(2,6rem)] sm:mt-12 sm:grid-cols-[minmax(0,1.5fr)_repeat(var(--n),minmax(0,1fr))]\"\n          role=\"table\"\n          style={{ \"--n\": columns.length } as CSSProperties}\n        >\n          <div\n            aria-hidden\n            className=\"pointer-events-none rounded-2xl bg-card\"\n            style={{ gridColumn: 2, gridRow: `1 / span ${totalRows}` }}\n          />\n          <div\n            aria-hidden\n            className=\"pointer-events-none z-30 rounded-2xl border shadow-lg/5 ring-1 ring-foreground/2 dark:shadow-black/30\"\n            style={{ gridColumn: 2, gridRow: `1 / span ${totalRows}` }}\n          />\n\n          <div className=\"contents\" role=\"row\">\n            <div\n              className=\"sticky top-0 z-20 flex items-end bg-background/95 pb-4 backdrop-blur-md\"\n              role=\"columnheader\"\n              style={{ gridColumn: 1, gridRow: 1 }}\n            >\n              <span className=\"text-muted-foreground text-xs\">Features</span>\n            </div>\n            {columns.map((col) => {\n              const ours = col.id === us.id;\n              return (\n                <div\n                  className={cn(\n                    \"sticky top-0 z-20 flex flex-col items-center justify-end gap-1 px-2 pt-5 pb-4 text-center backdrop-blur-md\",\n                    ours ? \"mx-px mt-px rounded-t-[calc(var(--radius-2xl)-1px)] bg-card/90\" : \"bg-background/95\",\n                    cell(col.id),\n                  )}\n                  key={col.id}\n                  role=\"columnheader\"\n                  style={place(col.id, 1)}\n                >\n                  {ours && us.mark}\n                  <span className={cn(\"text-balance font-medium text-sm leading-tight\", !ours && \"text-muted-foreground\")}>\n                    {col.name}\n                  </span>\n                  {col.note && <span className=\"hidden text-[0.6875rem] text-muted-foreground sm:block\">{col.note}</span>}\n                </div>\n              );\n            })}\n          </div>\n\n          {groups.map((group, g) => {\n            const groupRow = ++r;\n            return (\n            <Fragment key={group.name}>\n              <div className=\"contents\" role=\"row\">\n                <div\n                  className={cn(\n                    \"pb-2 font-medium text-[0.6875rem] text-muted-foreground uppercase tracking-wider\",\n                    g === 0 ? \"pt-2\" : \"pt-7\",\n                  )}\n                  role=\"rowheader\"\n                  style={{ gridColumn: 1, gridRow: groupRow }}\n                >\n                  {group.name}\n                </div>\n              </div>\n              {group.rows.map((row) => {\n                const rowIndex = ++r;\n                return (\n                <div className=\"contents\" key={row.label} role=\"row\">\n                  <div\n                    className=\"flex min-h-12 flex-col justify-center border-t py-3 pe-3\"\n                    role=\"rowheader\"\n                    style={{ gridColumn: 1, gridRow: rowIndex }}\n                  >\n                    <span className=\"text-pretty text-sm leading-snug\">{row.label}</span>\n                    {row.hint && <span className=\"mt-0.5 hidden text-muted-foreground text-xs sm:block\">{row.hint}</span>}\n                  </div>\n                  {columns.map((col) => {\n                    const ours = col.id === us.id;\n                    const index = ours ? tick++ : 0;\n                    return (\n                      <div\n                        className={cn(\n                          \"flex min-h-12 items-center justify-center border-t px-2 py-3 text-center\",\n                          ours && \"mx-px border-foreground/6\",\n                          cell(col.id),\n                        )}\n                        key={col.id}\n                        role=\"cell\"\n                        style={place(col.id, rowIndex)}\n                      >\n                        <Value index={index} ours={ours} value={row.values[col.id]} />\n                      </div>\n                    );\n                  })}\n                </div>\n                );\n              })}\n            </Fragment>\n            );\n          })}\n\n          {cta && (\n            <div className=\"contents\" role=\"row\">\n              <div className=\"border-t\" role=\"cell\" style={{ gridColumn: 1, gridRow: totalRows }} />\n              <div\n                className=\"mx-px border-foreground/6 border-t px-1.5 pt-4 pb-4 sm:px-4\"\n                role=\"cell\"\n                style={{ gridColumn: 2, gridRow: totalRows }}\n              >\n                <Button\n                  className=\"group w-full transition-[box-shadow,translate,scale,rotate] duration-150 ease-out active:scale-[0.97] max-sm:px-2 max-sm:text-sm\"\n                  render={<a href={cta.href} />}\n                  size=\"sm\"\n                >\n                  <span className=\"truncate\">{cta.label}</span>\n                  <ArrowRightIcon className=\"hidden transition-transform duration-200 ease-out group-hover:translate-x-0.5 sm:block\" />\n                </Button>\n              </div>\n              {them.map((col) => (\n                <div className={cn(\"border-t\", cell(col.id))} key={col.id} role=\"cell\" style={place(col.id, totalRows)} />\n              ))}\n            </div>\n          )}\n        </div>\n        <motion.p\n          className=\"mt-6 text-balance text-center text-muted-foreground text-xs\"\n          initial={{ opacity: 0 }}\n          transition={{ duration: 0.4, ease }}\n          viewport={{ once: true }}\n          whileInView={{ opacity: 1 }}\n        >\n          Compared against public plans and docs as of October 2026.\n        </motion.p>\n      </section>\n    </MotionConfig>\n  );\n}\n"
    }
  ]
}