Data in site pages
A site built on @recit/site with recit/config (@recit/) can use the four data
directives of @recit/data — :value, :::kpi, ::chart and ::table — directly inside its
pages/*.md and pages/*.mdx files, with the exact same syntax and
attributes as a report or a deck.
Setup
Add @recit/data to the site's dependencies (and @recit/geo when pages draw type=
or type=points maps):
package.json
No extra import is needed in recit.:
- Every figure, number and table is computed at build time in Node as static HTML and SVG. Raw source paths and inline rows are stripped from the page's client front matter.
@recit/(anddata/ styles.css @recit/on pages with maps) is imported only by the lazy route chunk of pages that render data directives, never ingeo/ styles.css entry.client.@recit/(keyboard arrow navigation across marks and hover/focus tooltips) loads on demand after hydration only on pages that render a chart figure.data/ client - A page without
data:in its front matter does not change by a single byte. - A missing data file or an invalid directive attribute stops the build with the page's file path
and 1-based line number (
✖ pages/).metrics. mdx: 5 — source "sales": cannot read ./ missing.csv
Declare data: in front matter
List CSV, JSON or YAML tables, inline rows, or precomputed
chart.json files relative to the page (a CSV file may use
, or ; as its separator, detected from its header line; a header name that is empty or repeated
is an error):
pages/metrics.mdx
An inline rows entry (or a plugin source: entry) can also declare meta provenance (title,
url, publisher, license, modified). When ::chart has no source= attribute, it builds its
Source: credit line from publisher, title and (license):
YAML
Inline :value and :::kpi
Across the five months in ./data-, total revenue reaches 783 units across 228 orders:
- Total revenue
- 783
- Five months, Lorem region
- Peak month
- 194
- March 2026
- Orders
- 228
- Cumulative volume
Bar ::chart with highlight= and marks=
highlight= puts one or more categories or series forward (outlined in the text ink while the other
bars fade), and marks= draws dashed reference lines across x or y. Under every chart, the «
Data » disclosure (« Données » when the site's metadata.lang or the page's lang is fr)
exposes the plotted table:
Revenue
Month
Source: Lorem dataset, 2026
Data
| Month | revenue |
|---|---|
| January 2026 | 118 |
| February 2026 | 142 |
| March 2026 | 194 |
| April 2026 | 158 |
| May 2026 | 171 |
Heatmap with rowGroups and hatched null
Ready chart.json files support grouped rows (rowGroups) and missing cells (null, drawn with a
45° « No data » hatch in the grid and in the scale legend):
Index
- < 80 index
- 80 – 110 index
- 110 – 140 index
- 140 – 170 index
- ≥ 170 index
- No data
Source: Lorem dataset, 2026
Data
| Group | Row | Morning | Midday | Afternoon | Evening |
|---|---|---|---|---|---|
| Weekday | Monday | 74 | 108 | 122 | 86 |
| Weekday | Tuesday | 82 | No data | 118 | 91 |
| Weekday | Wednesday | 79 | 114 | 129 | 88 |
| Weekend | Saturday | 116 | 162 | 184 | 132 |
| Weekend | Sunday | 104 | 148 | 168 | 119 |
Points map (type=points)
When @recit/geo is installed, ::chart also renders type= and type=points in
longitude and latitude, with sized groups, colour roles, connecting lines and highlight:
- Saturated
- Reserve
- Lines
Source: Lorem dataset, 2026
Data
| Label | Group | Volume | Latitude | Longitude |
|---|---|---|---|---|
| Lorem | Saturated | 60 | 45 | 2.6 |
| Ipsum | Saturated | 42 | 44.9 | 4 |
| Dolor | Reserve | 24 | 45.8 | 3.3 |
| Amet | Reserve | 18 | 45.7 | 4.9 |
Formatted ::table
::table renders sorted, filtered rows from any declared source:
| month | region | revenue | orders |
|---|---|---|---|
| March 2026 | Lorem | 194 | 56 |
| May 2026 | Lorem | 171 | 50 |
| April 2026 | Lorem | 158 | 47 |
| February 2026 | Lorem | 142 | 41 |