# Data in a deck

A deck reads the four data directives of `@recit/data` (`:value`, `::chart`, `::table` and
`:::kpi`), whether authored by hand or produced from a report by
`recit convert report.md --to deck`. Every number and SVG is computed at build time in Node, in
Markdown (`.md`), MDX (`.mdx`) and the JSON twin alike.

The complete list of attributes, schemas and diagnostics is in
[Data directives](/formats/report/data); the live deck is played on
[the Data demo of presentation.recit.dev](https://recit.dev/presentation/demos/data) (`examples/deck-data`).

## The `data:` front matter

Name your sources under `data:` in the deck's front matter (or in the `data` field of its JSON twin
or sidecar): CSV, JSON or YAML files relative to the story, inline `rows`, or ready charts
(`{ chart: ./charts/visits.json }`).

```md title="slides.md"
---
title: Data Deck
author: Lorem Ipsum Team
lang: en
data:
  sales: ./data/sales.csv
  visits: { chart: ./charts/visits.json }
  figures: { chart: ./charts/figures.json }
  areas: { chart: ./charts/areas.json }
  spots: { chart: ./charts/spots.json }
---
```

`recit` installs only `@recit/cli` and `@recit/core`: the data directives (`value`, `chart`,
`table`, `kpi`) and the maps of `::chart` belong to features outside 1.0 (`@recit/data` and
`@recit/geo`, optional peer dependencies and preview packages outside the 1.0 contract; see
[Stability](/documentation/reference/stability)). A deck with data requires installing `@recit/data`
next to `recit` (`npm install @recit/data`), and `@recit/geo` as well for the maps of `::chart`
(`npm install @recit/geo`). Once installed, `recit dev`, `recit build` and `recit export` load them
on demand and bundle `@recit/data/styles.css`, and `recit dev` reloads when a data file changes. A
Récit site that publishes a deck with data lists `"@recit/data"` in its `dependencies` (and
`"@recit/geo"` as well when `::chart` draws maps) and imports `"@recit/data/styles.css"` in its
`recit.config.ts`.

## Inline `:value` and `:::kpi`

`:value{…}` writes one computed figure inside a `<data value="…">` element, formatted in the deck's
`lang`. `:::kpi` arranges a list of `:value` items as key-figure tiles (`cols` from `1` to `6`, `4`
by default).

```md
--- id=kpi-two

# Two key figures

:::kpi{cols=2}
- :value{data=sales field=revenue agg=sum format=compact} Revenue
  First quarter, two regions
- :value{data=sales field=orders agg=sum} Orders
:::

::source[Lorem ipsum dataset, [dolor sit amet](https://example.com)]

:::howto{caption="Lorem ipsum dolor sit amet, 2026."}

Consectetur adipiscing elit: sed do eiusmod tempor incididunt.

:::

:::limits{visible=2}

- Lorem ipsum dolor sit amet.
- Consectetur adipiscing elit.
- Sed do eiusmod tempor incididunt.

:::
```

In a 16:9 slide, keep at most four figures per row: a tile narrower than `9rem` wraps to a second
row instead of clipping its value. `::source[…]`, `:::howto{caption="…"}` and `:::limits{visible=2}`
attach provenance, a reading guide and folded caveats beneath the block.

## `::chart` and the `slide` drawing format

In a deck, `::chart` defaults to `layout=slide`: a wide, low drawing of **720 × 180** units (instead
of `640 × 320` on a page), sized for the room a 16:9 slide body leaves beneath an `h1` title and
above the footer.

```md
--- id=line

# Line

::chart{data=visits}
```

- **Readable labels without overflow.** At 1280 × 720, the `11`-unit SVG labels render near 16 px;
  only the SVG shrinks when a slide holds extra elements, while the HTML frame (caption, subtitle,
  legend, scale, source and « Data » disclosure) keeps its own text sizes rather than inheriting the
  slide's `cqw` prose rules.
- **Bottom axis title in the SVG.** Unlike a page, `layout=slide` draws `xLabel` inside the SVG
  beneath the tick labels so it stays aligned with the end of the axis when the drawing shrinks.
- **Light and dark mode.** Series tints (`--recit-chart-1` to `8`) and semantic `roles` (`alert`,
  `solution`, `reference`, `context`) follow `data-mantine-color-scheme` when pressing **T**, with
  no redraw.
- **Keyboard and pointer inspection.** When a deck holds a chart, `@recit/data/client` loads on
  demand: focusing the chart and pressing `ArrowLeft` or `ArrowRight` steps across data points and
  announces values without changing slides (`PageDown` and `PageUp` still move the deck).

All chart kinds of `@recit/data` fit a slide: `line`, stacked `area`, vertical and horizontal `bar`,
`dot`, `heatmap`, `scatter`, `facet=series` small multiples, `kpi`, and the two maps below.

On a projected slide, pass `details=false` on `::chart` — or set `deck.charts.details: false` in
`recit.config.ts` for every `::chart` of the deck (`details=true` on a chart does not reopen it, and
`::map` is unchanged) — to omit the « Data » disclosure: the table is no longer on the page while
the SVG's `<title>` and `<desc>` stay. Without the table, keyboard and pointer tooltips have no
values to show on series and heatmap charts, and on `::chart{details=false}`
`recit export --to pptx` falls back to an image of the chart instead of a native, editable one.

```md
::chart{data=visits details=false}
```

## `::table`

`::table` renders formatted rows from a source with `scope` on its headers:

```md
::table{data=sales columns="month,region,revenue,orders" sort=-revenue limit=6}
```

`format="revenue=currency"` with `currency=EUR` formats a number column (`format=percent` formats
them all), and `rename="month=Month"` writes a header under another name, as in a report.

Keep slide tables short so every row stays legible from the back of a room. When
`recit convert --to deck` turns a report section into a slide, any `::table` above 8 rows receives
`limit=8` with a warning.

## Ready charts (`{ chart: ./x.json }`)

A script can precompute a chart into a JSON file validated by
[`https://recit.dev/schema/v1/chart.json`](https://recit.dev/schema/v1/chart.json) and declare it in
`data:` as `{ chart: ./charts/visits.json }`. The JSON file brings the `type`, axes, series, marks
and `roles`, so the slide stays one line:

```json title="charts/visits.json"
{
  "$schema": "https://recit.dev/schema/v1/chart.json",
  "type": "line",
  "title": "Lorem visits by month",
  "subtitle": "Dolor sit amet, index 100 = average month",
  "source": "Lorem dataset, 2026",
  "x": ["2026-01", "2026-02", "2026-03", "2026-04"],
  "xLabel": "Month",
  "yLabel": "Visits",
  "unit": "index",
  "series": [
    { "name": "Lorem", "values": [120, 155, 159, 163] },
    { "name": "Ipsum", "values": [119, 117, 115, 110] }
  ],
  "roles": { "Lorem": "alert", "Ipsum": "reference" }
}
```

One ready chart can feed several slides by filtering on the directive (`series="Lorem"`,
`items="Visitors,Ratio"`, `rows=`, `cols=`, `groups=`, `x=2026-02..`), including inside an MDX deck
(`charts.story.mdx` in `examples/deck-data`). See
[A ready chart](/formats/report/data#a-ready-chart) for the full schema and selection rules.

## Maps with `@recit/geo`

When `@recit/geo` (an optional preview package outside the 1.0 contract) is installed next to
`recit` (`npm install @recit/geo`), `::chart` also draws `type=choropleth` and `type=points` on a
local GeoJSON `FeatureCollection` in longitude and latitude (`base=` and `lines=`, resolved inside
the project folder of `recit.config.*` or the story's folder, never from a URL), fitted to the low
`slide` frame. A Récit site that publishes maps of `::chart` adds `"@recit/geo"` to its
`dependencies` alongside `"@recit/data"`:

```md
--- id=choropleth

# Choropleth

::chart{data=areas}

--- id=points

# Points

::chart{data=spots}
```

In `examples/deck-data`, `charts/areas.json` colours six shapes of `../maps/lorem.geojson` on custom
`breaks` with `L4` highlighted, and `charts/spots.json` plots sized and grouped points linked by
lines (`Busy` as `alert`, `Alternative` as `solution`). Details are in
[Maps](/formats/report/data#maps).

## PDF export, PowerPoint and presenter console

- **PDF and images (`recit export --to pdf`, `--to images`).** The print view (`?print=1`) renders
  every slide at its design size in the chosen `colorMode`: vector SVG charts, maps, `:::kpi` tiles,
  `:value` figures and `::table` rows print as drawn. Reading boxes (`:::howto`, `:::limits`,
  `:::details`) unfold automatically, while `::chart`'s « Data » table disclosure stays closed so it
  never pushes the slide past the page.
- **PowerPoint (`recit export --to pptx`, preview).** `:::kpi` tiles export as shapes and editable
  text boxes, and simple tables (`::table`) as editable PowerPoint tables; `line`, `bar`, `area` and
  plain `scatter` charts export as native editable PowerPoint charts from their raw values, ranked
  `heatmap` charts export as tinted PowerPoint tables, and other charts and maps export as 2× PNGs
  with their alternative text (see [Exporting](/formats/deck/exporting)).
- **Presenter console (`S`).** Both the current-slide and next-slide previews render the compiled
  SVG charts, maps and computed numbers alongside your `:::notes` (the previews stay static, while
  the audience window keeps keyboard and pointer tooltips; see
  [Presenter console](/formats/deck/presenter-console)).
