Skip to content
Klarhimmel UI

Case study, before and after

Case study, before and after previewCase study, before and after preview

Install

npx shadcn add @klarhimmel/case-study-before-after
DetailsAbout, usage, props and more

One dated result: client, a metric name, a before and an after figure, a short story, a link and an image.

Import

Import

import Block from '@/components/klarhimmel/blocks/case-study-before-after';
Also called
  • case-study/before-after
Category
One customer story: the problem, the work, the result. New project? Set it up once: /get-started/installation.

Notes

When to use it

One dated result presented as a single before and after figure with a short story, link and image. For several results at once use case-study-card, and for a full story with quote use case-study-metrics.

Writing for it

- Keep the metric line within a recommended 48 characters; the schema still accepts 80 for compatibility. Name the measurement, such as 'Median reply time', and leave the fuller result in the story. - For each side, use a label of at most 16 characters and a value of at most 12. These are recommendations, below the existing hard limits of 40 and 24; use matching units and move explanatory sentences into the summary. - The summary has 300 characters for what changed and over how long. Set showComparison to false when a comparison does not help the case; only the image remains in the right column.

Watch out for

The after figure is drawn in the accent colour and the before figure in muted grey, and the arrow between them is decorative. Do not swap them to show a decrease you want to look good, because the layout always reads as a positive step.

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 CaseStudyBeforeAfter from '@/components/klarhimmel/blocks/case-study-before-after';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <CaseStudyBeforeAfter props={{
          "eyebrow": "Name the section",
          "title": "Say what changed, from what to what",
          "client": "Name a client",
          "date": "Season and year",
          "metric": "Name what was measured over time",
          "before": {
            "label": "Before",
            "value": "00 units"
          },
          "after": {
            "label": "After",
            "value": "00 units"
          },
          "summary": "Say in two sentences what the client did before and what they tried, then what changed. Say who reviews the result now, and how.",
          "link": {
            "label": "Read about this case",
            "href": "#client"
          },
          "media": {
            "src": "/pictures/scr-report.avif",
            "alt": "A report with one overall score and what it found",
            "srcDark": "/pictures/scr-report-dark.avif"
          }
        }} />
      </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 section'Text, up to 60 characters.
titlestring'Say what changed, from what to what'Text, up to 120 characters.
clientstring'Name a client'Text, up to 60 characters.
datestring'Season and year'Text, up to 30 characters.
metricstring'Name what was measured over time'Recommended maximum: 48 characters. Name the measurement, not the whole result. Text, up to 80 characters.
showComparisonboolean-Show the metric and before/after strip. Defaults to true; false leaves only the illustration. Optional; empty is not rendered.
before{ label, value }{…}Recommended: label at most 16 characters and value at most 12. Put context in the summary. Fields: label, value.
after{ label, value }{…}Recommended: label at most 16 characters and value at most 12. Put context in the summary. Fields: label, value.
summarystring'Say in two sentences what the clien…'Text, up to 300 characters.
linkLink{…}See the type.
mediaMedia{…}See the type.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.