Skip to content
Klarhimmel UI

Cards, two up

Cards, two up previewCards, two up preview

Install

npx shadcn add https://ui.klarhimmel.com/r/cards-two-up.json
DetailsAbout, usage, props and more

A centred heading over two large dark cards side by side, each with a picture on top, a title, a line and one or two buttons; stacked on a narrow screen.

Import

Import

import Block from '@/components/klarhimmel/blocks/cards-two-up';
Also called
  • cards/two-up
Category
Two cards side by side, each with a picture, a line and a link. New project? Set it up once: /get-started/installation.

Notes

When to use it

A centred heading over two large dark cards side by side, each with a picture, a title, a line and one or two buttons. Use it for two audiences or two offers, and features-image-cards for more.

Writing for it

- Make the two cards parallel: one for each audience or each way in, with the same shape of title and line. - Choose a picture of the offer, upright or wide, since it sits centred at the top of the card. - Say in one line what each way in gives the person and what they no longer do themselves.

Watch out for

There are exactly two cards, so a third offer needs another block. On a narrow screen they stack, and a wide picture then fills the width.

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 CardsTwoUp from '@/components/klarhimmel/blocks/cards-two-up';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <CardsTwoUp props={{
          "title": "Name the choice in a line",
          "cards": [
            {
              "title": "Name the first audience",
              "description": "Say in one line what this way in gives them and what they no longer do themselves.",
              "media": {
                "src": "/pictures/photo-clean1.avif",
                "alt": "A bright white kitchen with a marble island"
              },
              "primary": {
                "label": "First action",
                "href": "#first"
              },
              "secondary": {
                "label": "Other action",
                "href": "#other"
              }
            },
            {
              "title": "Name the second audience",
              "description": "Say in one line how this way in differs and what it adds for them.",
              "media": {
                "src": "/pictures/photo-coffee2.avif",
                "alt": "Coffee beans and ground coffee on a wooden board"
              },
              "primary": {
                "label": "Second action",
                "href": "#second"
              },
              "secondary": {
                "label": "Other action",
                "href": "#other"
              }
            }
          ]
        }} />
      </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 choice in a line'Text, up to 48 characters.
cards{ title, description, media, primary, secondary }[]2 itemsList of 2 to 2. Each item: title, description, media, primary, secondary (optional).
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.