Skip to content
Klarhimmel UI

Docs, table

Docs, table previewDocs, table preview

Install

npx shadcn add @klarhimmel/docs-table
DetailsAbout, usage, props and more

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

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.

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.

PropTypeDefaultDescription
eyebrowstring'Name the section'Text, up to 60 characters.
titlestring'Say what the table lists'Text, up to 80 characters.
descriptionstring'Say in a sentence what the rows hav…'Text, up to 300 characters.
columns{ label, variant }[]3 itemsList of 2 to 6. Each item: label, variant ('text' | 'mono' | 'badge').
rows{ cells }[]4 itemsList of 1 to 40. Each item: cells.
actionLink{…}See the type.
notestring'Say what to watch for beneath the t…'Text, up to 200 characters.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.