# Docs, table

- **[Sections](/blocks/)**
- **[Docs](/blocks/docs/)**
- **Docs, table**

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.

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/docs-table
  ```
- **Import**

  ```
  import Block from '@/components/klarhimmel/blocks/docs-table';
  ```

Also called

- docs/table

- **Category**: Documentation sections: headers, install panels, props tables, previews. New project? Set it up once: /get-started/installation.

## Notes

- **When to use it**: A titled table with columns you define, such as keyboard keys, tokens, variables or a changelog. For component props use `docs-props-table`, which has the fixed columns.
- **Writing for it**: - Choose 2 to 6 columns and give each a variant: text for prose, mono for code, badge for short labels. The first column becomes the row header.
- Cells hold 160 characters and a row has up to 6 cells. Put the identifier in the first column, since it labels the whole row.
- Add a note of 200 characters or an action link under the table for the thing a reader will ask next. The eyebrow holds 60.
- **Watch out for**: A row with fewer cells than columns gets empty cells, and an empty badge cell is not drawn. The table scrolls sideways under 34rem, and mono cells never wrap.

## Pairs well with

- **[Docs, colour swatches](/blocks/docs/swatches)**
- **[Docs, props table](/blocks/docs/props-table)**
- **[Docs, related links](/blocks/docs/related)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import DocsTable from '@/components/klarhimmel/blocks/docs-table';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <DocsTable props={{
          "eyebrow": "Name the section",
          "title": "Say what the table lists",
          "description": "Say in a sentence what the rows have in common.",
          "columns": [
            {
              "label": "Column one",
              "variant": "mono"
            },
            {
              "label": "Column two",
              "variant": "badge"
            },
            {
              "label": "Column three",
              "variant": "text"
            }
          ],
          "rows": [
            {
              "cells": [
                "First item",
                "Name a scope",
                "Say what it does, in a line"
              ]
            },
            {
              "cells": [
                "Second item",
                "Name a scope",
                "Say what it does and what to know, in one or two sentences."
              ]
            },
            {
              "cells": [
                "Third item",
                "Name a scope",
                "Say what it does and what to know, in one or two sentences."
              ]
            },
            {
              "cells": [
                "Fourth item",
                "Name a scope",
                "Say what it does and what to know, in one or two sentences."
              ]
            }
          ],
          "action": {
            "label": "Main action",
            "href": "#tokens.json"
          },
          "note": "Say what to watch for beneath the table, in a line."
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

- **eyebrow**: Text, up to 60 characters.
- **title**: Text, up to 80 characters.
- **description**: Text, up to 300 characters.
- **columns**: List of 2 to 6. Each item: label, variant ('text' | 'mono' | 'badge').
- **rows**: List of 1 to 40. Each item: cells.
- **action**: See the type.
- **note**: Text, up to 200 characters.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

[Previous](/blocks/docs/swatches)

[Next](/blocks/app/access-detail)
