# Directory, preview

- **[Sections](/blocks/)**
- **[Directory](/blocks/directory/)**
- **Directory, preview**

Full-width preview of one block or screen: breadcrumbs, title, status badge, viewport toggle, Preview and Code tabs, actions and a framed stage that renders a…

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/directory-preview
  ```
- **Import**

  ```
  import Block from '@/components/klarhimmel/blocks/directory-preview';
  ```

Also called

- directory/preview

- **About**: Full-width preview of one block or screen: breadcrumbs, title, status badge, viewport toggle, Preview and Code tabs, actions and a framed stage that renders a registered demo by id.
- **Category**: Catalogue pages: headers with filters, card grids, full-width previews. New project? Set it up once: /get-started/installation.

## Notes

- **When to use it**: A full-width view of one block or screen, with title, status, viewport toggle and Preview and Code tabs. For a list of items to pick from use `directory-cards`.
- **Writing for it**: - The title holds 80 characters and the status 24. The description holds 200 and can name the layout in one sentence.
- Viewports take up to 3 labels of 20 characters, such as Desktop, Tablet and Mobile, in that order; the first is the full width.
- Set a demo id for the stage, or fall back to an image. Code holds 2000 characters and the tabs are limited to two, usually Preview and Code.
- **Watch out for**: The Code tab exists only when two tabs are written; with one tab the code is not shown. The title here is an h2, not an h1, so the page needs its heading from another block.

## Pairs well with

- **[Directory, header](/blocks/directory/header)**
- **[Directory, template info](/blocks/directory/template-info)**
- **[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 DirectoryPreview from '@/components/klarhimmel/blocks/directory-preview';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <DirectoryPreview props={{
          "breadcrumbs": [
            {
              "label": "First page",
              "href": "/catalogue/blocks/"
            },
            {
              "label": "Second page",
              "href": "/catalogue/blocks/hero/"
            },
            {
              "label": "Current page",
              "href": ""
            }
          ],
          "title": "Name what is shown",
          "status": "Free",
          "description": "Say in one sentence what it is, how it is laid out and when to use it.",
          "viewports": [
            "Wide view",
            "Mid view",
            "Narrow view"
          ],
          "tabs": [
            "First tab",
            "Second tab"
          ],
          "actions": [
            {
              "label": "Main action",
              "href": "#copy"
            }
          ],
          "demo": "hero-split-sample",
          "preview": {
            "src": "/pictures/photo-gelato1.avif",
            "alt": "Tubs of gelato in a display case"
          },
          "code": "import Block from '@/blocks/your-block';\n\nexport default function Page() {\n  return (\n    <Block\n      props={{\n        title: 'Say what the page offers',\n        primary: { label: 'Main action', href: '#go' },\n      }}\n    />\n  );\n}"
        }} />
      </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.

- **breadcrumbs**: List of up to 4.
- **title**: Text, up to 80 characters.
- **status**: Text, up to 24 characters.
- **description**: Text, up to 200 characters.
- **viewports**: List of up to 3.
- **tabs**: List of up to 2.
- **actions**: List of up to 3.
- **demo**: Text, up to 80 characters.
- **preview**: See the type.
- **code**: Text, up to 2000 characters.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

[Previous](/blocks/directory/header)

[Next](/blocks/directory/template-info)
