{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "comparison-table",
  "type": "registry:block",
  "title": "Comparison, us versus them",
  "description": "A table comparing you with one to three alternatives, feature by feature. Each cell says Included, Not included or Partly in words beside its icon. The header stays in view while the table scrolls, the feature column stays beside the others, and a caption appears when columns are cut off. For plans against plans use the pricing block.",
  "categories": [
    "comparison"
  ],
  "dependencies": [
    "lucide-react@^1.49.0",
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/kit-app.json",
    "https://ui.klarhimmel.com/r/kit-c-proof.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/comparison-table/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/comparison-table/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, t } from '../_shared/schema';\n\nconst verdict = z.enum(['yes', 'no', 'partial']);\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: t(120),\n  description: t(300),\n  /** Names the table for screen readers. */\n  caption: t(80),\n  /** The column heading above the feature names. */\n  featureLabel: t(30),\n  ours: t(30),\n  others: z.array(t(30)).min(1).max(3),\n  /** One row per feature. `values` has one verdict for us, then one for each of `others`, in order. */\n  rows: z.array(z.object({ feature: t(60), note: t(100).optional(), values: z.array(verdict).min(2).max(4) })).min(3).max(10),\n  /** The words for each verdict. A verdict is always said in words, never only a tick or a cross. */\n  words: z.object({ yes: t(20), no: t(20), partial: t(20) }),\n  /** Shown under the table while some of it is cut off at the edge. */\n  scrollHint: t(40),\n  cta: link,\n});\n\nexport const spec = defineSpec({\n  type: 'comparison-table',\n  aliases: ['comparison/table'],\n  name: 'Comparison, us versus them',\n  category: 'comparison',\n  role: 'body',\n  description: 'A table comparing you with one to three alternatives, feature by feature. Each cell says Included, Not included or Partly in words beside its icon. The header stays in view while the table scrolls, the feature column stays beside the others, and a caption appears when columns are cut off. For plans against plans use the pricing block.',\n  schema,\n  defaults: {\n    eyebrow: 'Name the topic',\n    title: 'Say how the options differ',\n    description: 'Say in one or two sentences what the table compares and why it is honest.',\n    caption: 'Say what is compared, so a screen reader can name the table.',\n    featureLabel: 'Name the rows',\n    ours: 'Our option',\n    others: ['First option', 'Second option'],\n    rows: [\n      { feature: 'Name a first feature, in a line', values: ['yes', 'no', 'yes'] },\n      { feature: 'Name a second feature, in a short line', note: 'Say what it means for them', values: ['yes', 'partial', 'yes'] },\n      { feature: 'Name a third feature, in a line', values: ['yes', 'partial', 'no'] },\n      { feature: 'Name a fourth feature', values: ['yes', 'no', 'no'] },\n      { feature: 'Name a fifth feature', values: ['yes', 'yes', 'partial'] },\n      { feature: 'Name a sixth feature', values: ['yes', 'no', 'partial'] },\n    ],\n    words: { yes: 'Included', no: 'Not included', partial: 'Partly' },\n    scrollHint: 'Say how to reveal the other columns',\n    cta: { label: 'Main action', href: '#trial' },\n  },\n});\n"
    },
    {
      "path": "src/blocks/comparison-table/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/comparison-table/index.tsx",
      "content": "import { Check, Minus, X } from 'lucide-react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { cn } from '../../lib/utils';\nimport { ActionLink, Container, Opt, Section } from '../_shared/kit';\nimport { Heading, useHeadingId } from '../_shared/c-proof-kit';\nimport { ScrollRegion } from '../_shared/app-kit';\nimport { spec } from './spec';\nimport type { BlockProps } from '../types';\nimport type { z } from 'zod';\n\nexport { spec };\ntype Props = z.infer<typeof spec.schema>;\n\nconst icon = { yes: Check, no: X, partial: Minus } as const;\n\nfunction ComparisonTable({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  const cols = [props.ours, ...props.others];\n  return (\n    <Section labelledBy={id}>\n      <Container>\n        <Heading id={id} eyebrow={props.eyebrow} title={props.title} description={props.description} />\n        <div className=\"mt-12 overflow-hidden rounded-kh-xl border border-kh-line bg-kh-surface\">\n          <ScrollRegion label={props.caption} hintText={props.scrollHint} innerClassName=\"max-h-[34rem] overflow-y-auto\" hint={<Text path={['scrollHint']} value={props.scrollHint} as=\"span\" />}>\n            <table className=\"w-full min-w-[38rem] border-collapse text-kh-small\">\n              <caption className=\"sr-only\">\n                <Text path={['caption']} value={props.caption} as=\"span\" />\n              </caption>\n              <thead>\n                <tr>\n                  <th scope=\"col\" className=\"sticky left-0 top-0 z-20 bg-kh-surface-2 px-4 py-4 text-left font-medium text-kh-muted\">\n                    <Text path={['featureLabel']} value={props.featureLabel} as=\"span\" />\n                  </th>\n                  {cols.map((c, j) => (\n                    <th key={j} scope=\"col\" className={cn('sticky top-0 z-10 px-4 py-4 text-left text-kh-body font-semibold', j === 0 ? 'bg-kh-accent-soft text-kh-accent-ink' : 'bg-kh-surface-2')}>\n                      <Text path={j === 0 ? ['ours'] : ['others', j - 1]} value={c} as=\"span\" />\n                    </th>\n                  ))}\n                </tr>\n              </thead>\n              <tbody className=\"divide-y divide-kh-line\">\n                {props.rows.map((r, i) => (\n                  <tr key={i}>\n                    <th scope=\"row\" className=\"sticky left-0 z-[1] min-w-48 bg-kh-surface px-4 py-4 text-left font-medium text-kh-ink\">\n                      <Text path={['rows', i, 'feature']} value={r.feature} as=\"span\" />\n                      <Opt path={['rows', i, 'note']} value={r.note} as=\"span\" className=\"mt-0.5 block text-kh-caption font-normal text-kh-muted\" placeholder=\"Note\" />\n                    </th>\n                    {cols.map((_c, j) => {\n                      const v = r.values[j];\n                      if (!v) return <td key={j} className=\"px-4 py-4\" />; // fewer verdicts than columns: leave it blank, never claim \"Not included\"\n                      const Icon = icon[v];\n                      return (\n                        <td key={j} className={cn('px-4 py-4', j === 0 && 'bg-kh-accent-soft/40')}>\n                          <span className=\"inline-flex items-center gap-2\">\n                            <Icon aria-hidden className={cn('size-4 shrink-0', v === 'yes' ? 'text-kh-accent-ink' : 'text-kh-muted')} />\n                            <Text path={['words', v]} value={props.words[v]} as=\"span\" className={cn(v === 'no' && 'text-kh-muted')} />\n                          </span>\n                        </td>\n                      );\n                    })}\n                  </tr>\n                ))}\n              </tbody>\n            </table>\n          </ScrollRegion>\n        </div>\n        <ActionLink path={['cta']} value={props.cta} variant=\"primary\" size=\"lg\" className=\"mt-10\" />\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(ComparisonTable);\n"
    }
  ]
}
