# Docs, do and don't

- **[Sections](/blocks/)**
- **[Docs](/blocks/docs/)**
- **Docs, do and don't**

Side-by-side do and don't pairs, each with a short rule and an example image.

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/docs-do-dont
  ```
- **Import**

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

Also called

- docs/do-dont

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

## Notes

- **When to use it**: Pairs a correct and an incorrect way to use something, each with a picture, to settle the small judgment calls on a docs page. For a single recommended setup, `docs-preview-frame` is enough.
- **Writing for it**: - Give one pair per rule, from one to four pairs. Both texts hold 200 characters, enough for the rule and a short reason.
- The block already prints the words Do and Don't in front of each text, so start the sentence with the instruction itself and do not repeat the label.
- Make the two images the same subject and size, differing only in the thing the rule is about, and write alt text that says what is wrong in the wrong one.
- **Watch out for**: An image slot with no source is hidden outside the editor, leaving the text alone on one side. If only one side of a pair has a picture, the two columns look uneven, so fill both or neither.

## Pairs well with

- **[Docs, examples](/blocks/docs/examples)**
- **[Docs, page header](/blocks/docs/header)**
- **[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 DocsDoDont from '@/components/klarhimmel/blocks/docs-do-dont';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <DocsDoDont props={{
          "title": "Name the rules",
          "description": "Say in a sentence what the pairs help with.",
          "pairs": [
            {
              "doText": "Say what to do, in one sentence, with the reason.",
              "doMedia": {
                "src": "/pictures/photo-camp1.avif",
                "alt": "Tents pitched on grass above a lake"
              },
              "dontText": "Say what to avoid, in one sentence, and what to do instead.",
              "dontMedia": {
                "src": "/pictures/photo-clean1.avif",
                "alt": "A bright white kitchen with a marble island"
              }
            },
            {
              "doText": "Say what to do, in one sentence, with the reason.",
              "doMedia": {
                "src": "/pictures/photo-coffee2.avif",
                "alt": "Coffee beans and ground coffee on a wooden board"
              },
              "dontText": "Say what to avoid, in one sentence.",
              "dontMedia": {
                "src": "/pictures/photo-desk1.avif",
                "alt": "An open notebook with a pen and pencils on a desk"
              }
            }
          ]
        }} />
      </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.

- **title**: Text, up to 60 characters.
- **description**: Text, up to 200 characters.
- **pairs**: List of 1 to 4. Each item: doText, doMedia, dontText, dontMedia.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

[Previous](/blocks/docs/customise)

[Next](/blocks/docs/examples)
