Skip to content
Klarhimmel UI

Docs, customise panel

Docs, customise panel previewDocs, customise panel preview

Install

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

The component-page customise panel: a stage and its code beside a list of controls (select, toggle, text). The layout is static; the site wires the controls to the code.

Import

Import

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

Notes

When to use it

A component page panel where a stage and its code sit beside a column of controls, so a reader sees which settings exist. It is a static layout; for a plain stage with code and no controls use docs-preview-frame.

Writing for it

- Each control has a variant: select, toggle or text. A select needs its options (up to 6, 30 characters each) and its value must match one of them to be marked as current. - A toggle reads its value as on, true or yes to start switched on; anything else starts off. Write the value as the word the reader would expect beside the switch. - The code field holds 600 characters and the filename 60. Show the default state, because the controls are labels and the code does not change when they are used.

Watch out for

The block itself never rewrites the code or the stage; the site has to wire that. The reset button is drawn disabled and dimmed, so do not promise in the description that it works on the published page unless the host connects it.

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

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <DocsCustomise props={{
          "title": "Name the panel",
          "description": "Say what changing a setting does here",
          "preview": {
            "src": "/pictures/photo-optic1.avif",
            "alt": "Silver-framed glasses on a white table"
          },
          "demo": "button-primary",
          "filename": "your-file.tsx",
          "code": "<Component option=\"first\" size=\"md\">\n  Label text\n</Component>",
          "reset": "Reset",
          "controls": [
            {
              "label": "Setting one",
              "variant": "select",
              "value": "Option one",
              "options": [
                "Option one",
                "Option two",
                "Option three"
              ]
            },
            {
              "label": "Setting two",
              "variant": "select",
              "value": "Option two",
              "options": [
                "Option one",
                "Option two",
                "Option three"
              ]
            },
            {
              "label": "Setting three",
              "variant": "text",
              "value": "Text value",
              "options": []
            }
          ]
        }} />
      </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 the panel'Text, up to 60 characters.
descriptionstring'Say what changing a setting does he…'Text, up to 200 characters.
previewMedia{…}Optional; empty is not rendered.
demostring'button-primary'Text, up to 80 characters. Optional; empty is not rendered.
filenamestring'your-file.tsx'Text, up to 60 characters.
codestring'<Component option="first" size="md"…'Text, up to 600 characters.
resetstring'Reset'Text, up to 20 characters.
controls{ label, variant, value, options }[]5 itemsList of up to 8. Each item: label, variant ('select' | 'toggle' | 'text'), value, options.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.