Skip to content
Klarhimmel UI

Related content

Related content previewRelated content preview

Install

npx shadcn add @klarhimmel/related-content
DetailsAbout, usage, props and more

A shared grid of linked cards for other articles, projects, services, products or events. Images are optional.

Import

Import

import Block from '@/components/klarhimmel/blocks/related-content';
Also called
  • content/related
Category
Long-form text and timelines for about and policy pages. New project? Set it up once: /get-started/installation.

Notes

When to use it

A reusable group of other projects, articles, services, products or events shown after the main content. Use it to offer a few relevant destinations without repeating the item the visitor has just read.

Writing for it

- Give the section a specific title such as Other projects or More guides. Each card needs a destination and a title; keep its summary to one short sentence. Images are optional: omit media for a text-only event card, or supply an image with a useful description. - Choose between one and six related items and filter out the current page before passing the list. The whole card is one link, so its contents should not contain additional actions.

Watch out for

This block displays the list supplied by the page. It does not rank recommendations or load content. Check that every destination resolves and that a small set of items remains useful on a phone.

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 RelatedContent from '@/components/klarhimmel/blocks/related-content';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <RelatedContent props={{
          "title": "Name the next step",
          "description": "Say in one line what these lead to.",
          "items": [
            {
              "title": "Name the related page",
              "description": "Say what they find there, in a line",
              "href": "#guide",
              "media": {
                "src": "/pictures/photo-food1.avif",
                "alt": "Caramelised figs on a white plate"
              }
            },
            {
              "title": "Name the related page",
              "description": "Say what they find there, in a line",
              "href": "#project",
              "media": {
                "src": "/pictures/photo-gelato1.avif",
                "alt": "Tubs of gelato in a display case"
              }
            }
          ]
        }} />
      </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 next step'Text, up to 120 characters.
descriptionstring'Say in one line what these lead to.'Text, up to 300 characters.
items{ title, description, href, media }[]2 itemsList of 1 to 6. Each item: title, description, href, media (optional).
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.