{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "docs-table",
  "type": "registry:block",
  "title": "Docs, table",
  "description": "A titled table with free columns (tokens, keyboard keys, variables, changelog). A column renders as text, code or badge; the first cell of each row is its header.",
  "categories": [
    "docs"
  ],
  "dependencies": [
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/badge.json",
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/docs-table/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/docs-table/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, t } from '../_shared/schema';\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: t(80),\n  description: t(300),\n  columns: z.array(z.object({ label: t(40), variant: z.enum(['text', 'mono', 'badge']) })).min(2).max(6),\n  rows: z.array(z.object({ cells: z.array(t(160)).max(6) })).min(1).max(40),\n  action: link,\n  note: t(200),\n});\n\nexport const spec = defineSpec({\n  type: 'docs-table',\n  aliases: ['docs/table'],\n  name: 'Docs, table',\n  category: 'docs',\n  role: 'body',\n  description: 'A titled table with free columns (tokens, keyboard keys, variables, changelog). A column renders as text, code or badge; the first cell of each row is its header.',\n  schema,\n  defaults: {\n    eyebrow: 'Name the section',\n    title: 'Say what the table lists',\n    description: 'Say in a sentence what the rows have in common.',\n    columns: [\n      { label: 'Column one', variant: 'mono' },\n      { label: 'Column two', variant: 'badge' },\n      { label: 'Column three', variant: 'text' },\n    ],\n    rows: [\n      { cells: ['First item', 'Name a scope', 'Say what it does, in a line'] },\n      { cells: ['Second item', 'Name a scope', 'Say what it does and what to know, in one or two sentences.'] },\n      { cells: ['Third item', 'Name a scope', 'Say what it does and what to know, in one or two sentences.'] },\n      { cells: ['Fourth item', 'Name a scope', 'Say what it does and what to know, in one or two sentences.'] },\n    ],\n    action: { label: 'Main action', href: '#tokens.json' },\n    note: 'Say what to watch for beneath the table, in a line.',\n  },\n});\n"
    },
    {
      "path": "src/blocks/docs-table/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/docs-table/index.tsx",
      "content": "import { useId } from 'react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { Badge } from '../../ui/badge';\nimport { cn } from '../../lib/utils';\nimport { ActionLink, Container, Opt, Section, SectionHeader, useEditing } from '../_shared/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\nfunction DocsTable({ props }: BlockProps<Props>) {\n  const id = useId();\n  const editing = useEditing();\n  return (\n    <Section labelledBy={id} className=\"py-10 @3xl:py-14\">\n      <Container>\n        <SectionHeader id={id} eyebrow={props.eyebrow} title={props.title} description={props.description} />\n        {/* focusable so keyboard users can scroll it sideways */}\n        <div tabIndex={0} role=\"region\" aria-labelledby={id} className=\"mt-8 overflow-x-auto rounded-kh-lg border border-kh-line focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--kh-focus)\">\n          <table className=\"w-full min-w-[34rem] border-collapse text-left text-kh-small\">\n            <thead className=\"bg-kh-surface-2 text-kh-muted\">\n              <tr>\n                {props.columns.map((c, j) => (\n                  <th key={j} scope=\"col\" className=\"whitespace-nowrap px-4 py-3 font-medium\">\n                    <Text path={['columns', j, 'label']} value={c.label} as=\"span\" placeholder=\"Column\" />\n                  </th>\n                ))}\n              </tr>\n            </thead>\n            <tbody className=\"divide-y divide-kh-line bg-kh-surface\">\n              {props.rows.map((r, i) => (\n                <tr key={i} className=\"align-top\">\n                  {props.columns.map((c, j) => {\n                    const value = r.cells[j] ?? '';\n                    const path = ['rows', i, 'cells', j];\n                    const body =\n                      c.variant === 'mono' ? (\n                        <Text path={path} value={value} as=\"code\" placeholder=\"Cell\" className=\"whitespace-nowrap rounded-kh-sm bg-kh-surface-2 px-1.5 py-0.5 font-kh-mono text-kh-caption\" />\n                      ) : c.variant === 'badge' ? (\n                        value || editing ? <Badge tone=\"neutral\"><Text path={path} value={value} as=\"span\" placeholder=\"Cell\" /></Badge> : null\n                      ) : (\n                        <Text path={path} value={value} as=\"span\" placeholder=\"Cell\" />\n                      );\n                    return j === 0 ? (\n                      <th key={j} scope=\"row\" className=\"px-4 py-3.5 font-medium\">{body}</th>\n                    ) : (\n                      <td key={j} className={cn('px-4 py-3.5', c.variant === 'text' && 'min-w-48 text-kh-muted')}>{body}</td>\n                    );\n                  })}\n                </tr>\n              ))}\n            </tbody>\n          </table>\n        </div>\n        <p aria-hidden className=\"mt-2 text-kh-caption text-kh-muted @3xl:hidden\">Scroll sideways for the other columns.</p>\n        {(props.note || props.action.label || editing) && (\n          <div className=\"mt-5 flex flex-wrap items-center justify-between gap-x-6 gap-y-3\">\n            <Opt path={['note']} value={props.note} className=\"max-w-kh-prose text-kh-small text-kh-muted\" placeholder=\"Note\" />\n            <ActionLink path={['action']} value={props.action} variant=\"secondary\" size=\"md\" />\n          </div>\n        )}\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(DocsTable);\n"
    }
  ]
}
