Skip to content
Klarhimmel UI

Docs, anatomy

Docs, anatomy previewDocs, anatomy preview

Install

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

A diagram or live demo beside the part tree and part list of a compound component.

Import

Import

import Block from '@/components/klarhimmel/blocks/docs-anatomy';
Also called
  • docs/anatomy
Category
Documentation sections: headers, install panels, props tables, previews. New project? Set it up once: /get-started/installation.

Notes

When to use it

Shows how a compound component is built: a diagram or live demo on one side, the part tree and a list of part names on the other. When one setup or one set of variants is the point, docs-examples or docs-preview-frame fits better.

Writing for it

- The tree is a code panel of up to 600 characters, so list each part once with its nesting and leave props out; the parts list below carries the explanation. - Each part has a name of 40 characters and a description of 160. Start the description with what the part does, for example where it sits or what it groups. - Fill the demo field with a registered demo id when you have one. It wins over the preview image, and the image alt text should name the labelled parts.

Watch out for

The parts list allows 12 entries and is drawn only when it has at least one, outside the editor. The name column is a fixed 10rem wide on wider containers, so a long compound name wraps inside it instead of widening the column.

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 DocsAnatomy from '@/components/klarhimmel/blocks/docs-anatomy';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <DocsAnatomy props={{
          "title": "Name this part",
          "description": "Say in a sentence how the parts fit together.",
          "preview": {
            "src": "/pictures/photo-house1.avif",
            "alt": "A red wooden house with white windows and a white door"
          },
          "demo": "card-basic",
          "tree": "<Root>\n  <Header>\n    <Title />\n    <Description />\n  </Header>\n  <Content />\n  <Footer />\n</Root>",
          "parts": [
            {
              "name": "First part",
              "description": "Say what this part is for and how it behaves"
            },
            {
              "name": "Second part",
              "description": "Say what this part is for and how it behaves"
            },
            {
              "name": "Third part",
              "description": "Say what this part is for and how it behaves"
            },
            {
              "name": "Fourth part",
              "description": "Say what this part is for, briefly"
            },
            {
              "name": "Fifth part",
              "description": "Say what this part holds"
            },
            {
              "name": "Sixth part",
              "description": "Say what this part is for"
            }
          ]
        }} />
      </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
titlestring'Name this part'Text, up to 60 characters.
descriptionstring'Say in a sentence how the parts fit…'Text, up to 200 characters.
previewMedia{…}Optional; empty is not rendered.
demostring'card-basic'Text, up to 80 characters. Optional; empty is not rendered.
treestring'<Root> <Header> <Title /> …'Text, up to 600 characters.
parts{ name, description }[]6 itemsList of up to 12. Each item: name, description.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.