# Directory, cards

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

A heading and a grid of link cards with thumbnail, title, caption, meta and an optional tag or actions.

## Import

- **CLI**

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

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

Also called

- directory/cards

- **About**: A heading and a grid of link cards with thumbnail, title, caption, meta and an optional tag or actions. Catalogue cards, groups with "View all", category and template grids.
- **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 heading and a grid of link cards for catalogue entries, categories or templates, each with a thumbnail and caption. For a large set with filters, put `directory-header` above it.
- **Writing for it**: - Choose 2, 3 or 4 columns. Card titles hold 60 characters, descriptions 160 and meta 60, so give each card a title, one line of what is inside and a count.
- The tag holds 16 characters and fits one word such as New. Add up to two actions per card only when a card needs a second destination.
- Every card needs an image slot filled, since the thumbnail sits at 16 by 10 above the title. The block takes 1 to 40 cards.
- **Watch out for**: If the eyebrow, title and description are all empty the whole heading row goes, including the View all link. The card is one big link to its href, with actions raised above it, so never put an action on a card that has no href.

## Pairs well with

- **[Directory, header](/blocks/directory/header)**
- **[Directory, preview](/blocks/directory/preview)**
- **[Call to action, band](/blocks/cta/banner)**

## 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 DirectoryCards from '@/components/klarhimmel/blocks/directory-cards';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <DirectoryCards props={{
          "eyebrow": "Name the section",
          "title": "Say what the cards below let the reader choose",
          "description": "Say in one or two sentences what the cards have in common and how a reader should pick one.",
          "viewAll": {
            "label": "Link to all",
            "href": "/catalogue/"
          },
          "columns": "3",
          "items": [
            {
              "title": "Name card one",
              "description": "Say what this card leads to, in a short line",
              "meta": "00 items",
              "tag": "",
              "href": "/catalogue/components/",
              "media": {
                "src": "/pictures/photo-spa1.avif",
                "alt": "A treatment room with a massage table by a window"
              },
              "actions": []
            },
            {
              "title": "Name card two",
              "description": "Say what this card leads to, in a short line",
              "meta": "00 items",
              "tag": "Tag",
              "href": "/catalogue/blocks/",
              "media": {
                "src": "/pictures/photo-surf1.avif",
                "alt": "Surfboards lined up against a tree"
              },
              "actions": []
            }
          ]
        }} />
      </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.

- **eyebrow**: Text, up to 60 characters.
- **title**: Text, up to 120 characters.
- **description**: Text, up to 300 characters.
- **viewAll**: See the type.
- **columns**: One of '2', '3', '4'.
- **items**: List of 1 to 40. Each item: title, description, meta, tag, href, media, actions.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

[Previous](/blocks/gallery/thumbs)

[Next](/blocks/directory/header)
