---
title: "comparison"
description: "Two or three options side by side, measured on the same two to five rows."
---

> Documentation Index
> Fetch the complete documentation index at: https://sandrinodm.github.io/deckster/llms.txt
> Use this file to discover all available pages before exploring further.

# comparison

Use the `comparison` layout to set two or three options side by side and measure them on the same rows: you and a competitor, or the options of a decision. You write the options and rows in the frontmatter, mark which option wins each row, and can set the one you recommend on a panel under a badge.

## Example

[Live slide: "Pantry Lane now delivers at half the cost", slide 64 of the lookbook deck](https://sandrinodm.github.io/deckster/decks/lookbook/#/comparison-before-after)

`decks/lookbook/slides/comparison-before-after.mdx`:

```mdx
---
layout: comparison
title: Pantry Lane now delivers at half the cost
eyebrow: Before and after
reveal: true
budget: 1m
options:
  - name: Pantry Lane, 2024
    summary: Delivering in its own vans
  - name: Pantry Lane, 2026
    summary: Same hour with Wrenhaul
rows:
  - label: Same-day orders a shop
    values: [38 a week, 62 a week]
    winner: 2
  - label: Cost per delivery
    values: ["€6.80", "€3.20"]
    winner: 2
  - label: Complaints per 1,000
    values: ["14", "4"]
    winner: 2
  - label: Orders after noon
    values: [false, true]
    winner: 2
  - label: Orders over 25 kg
    values: [In its own van, Passed to a partner van]
    winner: 1
---

<Footnote>Pantry Lane Grocers, 34 shops in four cities: 2024 against October 2026.</Footnote>

<Notes>
`comparison` with two options as before and after, checks and dashes, and `reveal: true`; use it for a customer's own numbers, including the one that got worse.
[click] Pantry Lane in 2024, delivering from its own vans: 38 same-day orders a shop each week, and nothing taken after noon.
[click] And with us: 62 a week, at half the cost, with a third of the complaints. One thing got harder: crates over 25 kg now go to a partner van.
</Notes>
```

Two options serve here as before and after. Each row names its `winner`, drawn bold with a diamond, and the last row is won by the old way: setting `winner` on the rows your side loses keeps the slide honest. `false` and `true` draw a dash and a check. The reference below shows three options with `recommended: true`.

## When to use it

- **Two or three alternatives, two to five rows.** `options` and `rows` are both required. Each row has a `label` and one value per option, in the order of `options`: text, or `true` and `false`.
- **The same measures apply to every option.** If the options are ideas that are not alternatives, use [`cards`](https://sandrinodm.github.io/deckster/reference/layouts/cards/); if each option is one number, use [`stats`](https://sandrinodm.github.io/deckster/reference/layouts/stats/).
- **You recommend one.** `recommended: true` on at most one option sets its column on a panel with an accent rule under a badge, "Recommended" unless you write `badge:` (up to 20 characters).
- **You present one option per click.** `reveal: true` adds one option per step.

The title takes up to 50 characters, one line, so the rows fit under it. With three options the columns are narrower: a row `label` takes 18 characters instead of 24, a value 20 instead of 28, and an option's `summary` 24 instead of 36. More than three options or five rows is a [`table`](https://sandrinodm.github.io/deckster/reference/layouts/table/). For plans with a price each, use [`pricing`](https://sandrinodm.github.io/deckster/reference/layouts/pricing/); for what to do and what to avoid, [`do-dont`](https://sandrinodm.github.io/deckster/reference/layouts/do-dont/); and for pictures of one thing before and after a change, [`before-after`](https://sandrinodm.github.io/deckster/reference/layouts/before-after/).

## Reference

Frontmatter: `layout: comparison`; surface: the deck's default; title: required, 50 characters at most; PowerPoint: title-only slide.

Two or three options side by side, measured on the same two to five rows: us and them, or the options of a decision, from `options:` and `rows:` in the frontmatter. Each row has a label and one value per option (text, or true and false for a check and a dash) and may name its `winner`, the number of the option that wins that row, which is drawn bold with a diamond. Mark the option you recommend with `recommended: true`: its column is set on a panel with an accent rule under a badge (`badge:`, "Recommended" by default). `reveal: true` adds one option per click. Use stats when each option is one number, a table for more than three options or five rows, and cards for ideas that are not alternatives; use pricing for plans, do-dont for behaviours, before-after for pictures of a change, or shift for a change in words.

*Slide still (a lookbook slide in this layout, not the example below): A slide in the comparison layout: A bike beats a van on every row but one.* [Open the slide](https://sandrinodm.github.io/deckster/decks/lookbook/#/comparison-modes)

**Slots**

| Slot | Required | Takes | Budget | What goes in it |
| --- | --- | --- | --- | --- |
| `body` | no |  | — | Content outside every slot tag (in TSX, the default export). |
| `<Footnote>` | no | text | 24 words | A source or caveat on the bottom line. |

**Frontmatter fields**

| Field | Values | How to use it |
| --- | --- | --- |
| `eyebrow` | text | Write a few words of at most 40 characters, for example `eyebrow: Budget committee`, or leave it out. |
| `options` (required) | text | List 2 or 3 options in the order of their columns, each with `name` (up to 24 characters) and optionally `summary` (up to 36, 24 with three options) and `recommended: true` on the one you recommend. |
| `rows` (required) | text | List 2 to 5 rows, each with `label` (up to 24 characters, 18 with three options) and `values`, one per option (2 or 3) in the same order: text (up to 28, 20 with three options), or true and false for a check and a dash. Add `winner: 2` to a row to mark the option that wins it (1 to the number of options, in the order of `options`), drawn bold with a diamond in that cell; set it on the rows the recommended option loses too, so the slide is honest about the trade. |
| `badge` | default `Recommended` | Write the word over the recommended option, up to 20 characters, such as `badge: Our pick` or `badge: Empfohlen`; it defaults to "Recommended". |
| `reveal` | `true`, `false` (default) | Write `reveal: true` to show the items one per step, in order, or leave it out to show them all at once. |
| `chrome` | `true` (default), `false` | Write `chrome: false` to hide the page number, logo and progress bar on this slide, or `chrome: true` to show them. |

**Variants**

- three options — `options[].summary`: 24 characters; `rows[].label`: 18 characters; `rows[].values[]`: 20 characters

**Example**

```mdx
---
layout: comparison
title: Large trees cost more and cool far more
eyebrow: The species choice
options:
  - name: Ornamental pear
    summary: Planted across the city since 2005
  - name: London plane
    summary: What the plan proposes
    recommended: true
rows:
  - label: Cost to plant
    values:
      - "$1,900"
      - "$4,600"
    winner: 1
  - label: Crown at 20 years
    values:
      - "30 m²"
      - "240 m²"
    winner: 2
  - label: Survives a dry summer
    values:
      - false
      - true
    winner: 2
---

<Footnote>Costs include the soil cells; crowns from the Larkfield tree survey.</Footnote>

<Notes>
The plane costs two and a half times as much and shades eight times the ground.
</Notes>
```

## Common mistakes

**Two-option text in a three-option slide.** The narrower limits of the three-option variant are checked when the slide is built, so [`deck lint`](https://sandrinodm.github.io/deckster/review/lint/) reports them before it renders any slide:

```console
$ deck lint launch-review
decks/launch-review/slides/species.mdx
  error   schema (species): rows[0].label: The comparison layout sets at most 18 characters here (three options), got 21.
          Fix: Shorten it to the essentials; `deck layouts --json` lists the limits of each variant.
  error   schema (species): rows[0].values[0]: The comparison layout sets at most 20 characters here (three options), got 24.
          Fix: Shorten it to the essentials; `deck layouts --json` lists the limits of each variant.

launch-review: 2 errors, 0 warnings.
```

**A row with a value missing.** Every row needs one value per option; write `false` for a dash. A row with one value for two options stops the build with `rows[0].values: Expected a value for each option, got a list of 1 item.`

**Two recommended options.** The layout recommends at most one: `options: 2 options are recommended (Pear, Plane); a comparison recommends at most one.`

**A `winner` that counts from zero.** `winner` is the number of the option in the order of `options`, starting at 1.

**A long footnote.** The footnote takes up to 24 words; past that, `content-budget` reports `The footnote slot holds 31 words; its layout allows 24.`

## Related layouts

- [`table`](https://sandrinodm.github.io/deckster/reference/layouts/table/): more than three options or five rows, or exact values to look up.
- [`shift`](https://sandrinodm.github.io/deckster/reference/layouts/shift/): one change from the old state to the new, rather than options to choose from.
- [`cards`](https://sandrinodm.github.io/deckster/reference/layouts/cards/): two to four ideas of equal weight that are not alternatives.
- [`stats`](https://sandrinodm.github.io/deckster/reference/layouts/stats/): each option is one number.
- [`pricing`](https://sandrinodm.github.io/deckster/reference/layouts/pricing/): two to four plans side by side, each with its price and what it includes.
- [`do-dont`](https://sandrinodm.github.io/deckster/reference/layouts/do-dont/): two columns of examples, what to do and what to avoid.
- [`before-after`](https://sandrinodm.github.io/deckster/reference/layouts/before-after/): two pictures at the same size, labelled Before and After.

What `reveal` does is on [builds](https://sandrinodm.github.io/deckster/write-slides/builds/).

Source: https://sandrinodm.github.io/deckster/reference/layouts/comparison/index.mdx
