# Case study, before and after

- **[Sections](/blocks/)**
- **[Case study](/blocks/case-study/)**
- **Case study, before and after**

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

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/case-study-before-after
  ```
- **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.

## Pairs well with

- **[Logos, with results](/blocks/logo-cloud/results)**
- **[Testimonial, quote](/blocks/testimonials/quote)**
- **[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 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.

- **eyebrow**: Text, up to 60 characters.
- **title**: Text, up to 120 characters.
- **client**: Text, up to 60 characters.
- **date**: Text, up to 30 characters.
- **metric**: Recommended maximum: 48 characters. Name the measurement, not the whole result. Text, up to 80 characters.
- **showComparison**: Show the metric and before/after strip. Defaults to true; false leaves only the illustration. Optional; empty is not rendered.
- **before**: Recommended: label at most 16 characters and value at most 12. Put context in the summary. Fields: label, value.
- **after**: Recommended: label at most 16 characters and value at most 12. Put context in the summary. Fields: label, value.
- **summary**: Text, up to 300 characters.
- **link**: See the type.
- **media**: See the type.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

[Previous](/blocks/content/statement)

[Next](/blocks/case-study/card)
