Skip to content
Klarhimmel UI

Comparison, who it is for

Comparison, who it is for previewComparison, who it is for preview

Install

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

Two or three cards that each say who a choice is right for ("Choose us if", "Choose a spreadsheet if") with a few reasons, and an optional honest closing line.

Import

Import

import Block from '@/components/klarhimmel/blocks/comparison-cards';
Also called
  • comparison/cards
About
Two or three cards that each say who a choice is right for ("Choose us if", "Choose a spreadsheet if") with a few reasons, and an optional honest closing line. For comparisons where the answer depends on the reader, not a feature count.
Category
How it differs from the alternatives: a table that says yes, no or partly in words. New project? Set it up once: /get-started/installation.

Notes

When to use it

Two or three cards that each say who a choice is right for, with a closing line that admits when the alternative wins. For a dense feature matrix, use comparison-table.

Writing for it

- The first card is yours and the others are the alternatives. Head each with a phrase that starts the sentence, such as Choose us if, and let the points finish it. - Each card takes two to four points of 100 characters. Keep them to facts the reader can check about their own situation. - The closing line holds 200 characters. It is the part that earns trust, so write the case where you are not the right answer.

Watch out for

Card headings are h3 under the block title. If you drop the title the cards lose their parent heading, so keep a title when the block sits alone on a page.

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 ComparisonCards from '@/components/klarhimmel/blocks/comparison-cards';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <ComparisonCards props={{
          "eyebrow": "Name the topic",
          "title": "Say how to choose",
          "description": "Say honestly what the choice depends on and what to weigh, in one or two sentences.",
          "cards": [
            {
              "heading": "Say when to pick the first",
              "points": [
                "Name a first need",
                "Name a second need, in a short line",
                "Name a third need, in a short line"
              ]
            },
            {
              "heading": "Say when to pick the second",
              "points": [
                "Name a first need, with its details",
                "Name a second need, briefly",
                "Name a third need, in a short line"
              ]
            },
            {
              "heading": "Say when to pick the third",
              "points": [
                "Name a first need, with its details",
                "Name a second need, in a short line"
              ]
            }
          ],
          "honest": "Say honestly when another option is the better choice, and when it makes sense to come back.",
          "cta": {
            "label": "Main action",
            "href": "#fit"
          }
        }} />
      </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
eyebrowstring'Name the topic'Text, up to 60 characters.
titlestring'Say how to choose'Text, up to 120 characters.
descriptionstring'Say honestly what the choice depend…'Text, up to 300 characters.
cards{ heading, points }[]3 itemsList of 2 to 3. Each item: heading, points.
honeststring'Say honestly when another option is…'Text, up to 200 characters. Optional; empty is not rendered.
ctaLink{…}See the type.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.