Skip to content
InsightCharts

Search

Search guides and components

Core concepts

Templates

A template is one component that lays out a whole page from a title, figures and chart specs. It can be written as JSX or as one JSON document.

An atom draws one chart. A molecule combines a few atoms. A template arranges molecules and atoms into a whole page and handles the layout at narrow widths. It takes all of its content as props, so a complete page can be one JSON document written by a person, a CMS or a model.

A one-page summary. It has a headline that states the main finding with its number, a deck, a row of three or four key figures, one hero chart with a takeaway callout, two smaller supporting exhibits, a short list of actions and a source note.

Visual essay

Template

A long article read by scrolling. It has a headline, then an ordered list of blocks in a reading column, then a source note. The blocks are prose, figures, charts with a callout, scrolly sequences, pull quotes, stat rows, small multiples and chapter breaks. Exhibits can be wider than the column.

Scorecard

Template

A recurring report. It has a masthead with the report name and period, a headline that states the main change, a KPI grid with changes and sparklines, a ranked list beside one or two trend charts, an optional comparison table, short notes and a source note.

The catalogue has 20 templates in two groups. 10 are report-style page layouts, covered on this page. 10 are infographics: each draws one designed poster on a painted ground. The infographics guide covers those.

Choosing a template

Pick the template that matches what the reader needs from the page. Each template page has a "use when" and an "avoid when" that names the alternative.

typeWhat it isBuilt from
comparison-briefA compared with B on one page. It has a headline that states the result, the headline figures mirrored either side of their labels, one hero exhibit that shows both sides, paired exhibits on a shared scale, a verdict callout and a source note.atoms only
data-explorerA set of linked charts over one shared dataset that filter each other. It has a headline, a sentence of instructions with filter chips, a row of figures that recompute from the filtered rows, two to four charts and an optional detail table. It opens on selections the author chooses.Filter chips, Stat row, Linked charts
executive-briefA one-page summary. It has a headline that states the main finding with its number, a deck, a row of three or four key figures, one hero chart with a takeaway callout, two smaller supporting exhibits, a short list of actions and a source note.Stat row, Chart with callout
explainerA vertical infographic in one narrow column. It opens with a big number or a proportion statement (hook), then the hero exhibit, then numbered sections with one exhibit each, a conclusion with an optional link, and sources.Proportion statement
report-pageA section of an analytical report laid out as a document. It has a title block, a summary, numbered findings, then method, limitations and sources. Each finding has one exhibit, an observation and a separately labelled interpretation with a confidence rating and a caveat.atoms only
scorecardA recurring report. It has a masthead with the report name and period, a headline that states the main change, a KPI grid with changes and sparklines, a ranked list beside one or two trend charts, an optional comparison table, short notes and a source note.KPI grid, Ranked list, Comparison table
social-cardA graphic that states one fact, at a fixed aspect ratio (1:1, 4:5, 16:9 or 9:16). It has a kicker, a headline, one exhibit, a source and a credit, painted on the theme surface. A button downloads the whole card as a PNG.atoms only
story-deckA sequence of full-frame cards (title, stat, chart, quote, closing) that the reader swipes or steps through. Each card states one fact. It has an optional fixed aspect ratio, a keyboard-accessible pager and a stacked layout for print.atoms only
timeline-storyA story told in date order. It has a headline, one overview exhibit of the whole period (a timeline chart or an annotated line), dated chapters along a rail, a closing paragraph and a source note. Each chapter has a short text and an optional small exhibit.Annotated timeline
visual-essayA long article read by scrolling. It has a headline, then an ordered list of blocks in a reading column, then a source note. The blocks are prose, figures, charts with a callout, scrolly sequences, pull quotes, stat rows, small multiples and chapter breaks. Exhibits can be wider than the column.Chart with callout, Scrolly chart, Small multiple grid, Stat row

Choose an infographic instead when the piece is one image with little text that is shared as a picture.

A whole page as one spec

This is an executive brief. Open the JSON tab to see the document that produces the whole page.

Support review · Q3

Median first reply time fell from 4.1 hours in June to 1.8 hours in September 2025

The triage rota began in July. The weekend median was 6.2 hours in September.

Support operations

Median first reply, September
1.8 h
−2.3 h vs June
Tickets answered within a day
92%
+11 pts vs June
Satisfaction, out of 5
4.6
4.1 in June

Median first reply time fell from 4.3 hours in April to 1.8 hours in September

Median hours to first reply, by month, 2025

Weekend median first reply was 6.2 hours in September

Median hours to first reply, September 2025

Chat was 48% of tickets in September

Share of tickets by channel, September 2025

What to do

  1. Extend the rota to weekends

    The weekend median was 6.2 hours in September.

    Support · October

  2. Report the weekend median separately

    The overall median was 1.8 hours in September.

Source
Helpdesk export
Data
April to September 2025
Note
Illustrative data

Reading the spec from the top:

  • type names the template.
  • title, kicker, deck, byline, date are the masthead. The title is one plain statement of the main fact, with its number and period.
  • figures is plain data: three or four objects with the props of big number. The template renders them with a stat row.
  • hero and each entry of supporting are slots: their values are chart specs, each with its own type. A slot takes any component. The template sets a height when the spec does not.
  • takeaway is the callout beside the hero. lead is a short statement in bold and body is one or two sentences under it.
  • actions are numbered recommendations, as strings or { title, text, owner }.
  • sources, period, method, note become the closing source note.

The spec contains no functions, so it can be stored, sent over the network and validated.

Rendering a template

From JSON, render the spec with Insight. It resolves the template and every nested spec by name.

import { Insight } from "insightcharts";

export function Brief({ spec }) {
  return <Insight spec={spec} />;
}

In a server component you can load the spec and pass it straight through; it is serialisable.

app/briefs/[id]/page.tsx
import { Insight } from "insightcharts";

export default async function Page({ params }) {
  const { id } = await params;
  const spec = await fetch(`https://example.com/briefs/${id}.json`).then((r) => r.json());
  return <Insight spec={spec} />;
}

From JSX, import the template by name. Slots take React elements or specs. If you pass specs, call registerAll() once so their type names resolve (see nested specs); if you pass elements, you do not need it.

import { BarChart, ExecutiveBrief, LineChart } from "insightcharts";

<ExecutiveBrief
  title="Median first reply time fell from 4.1 hours in June to 1.8 hours in September 2025"
  figures={[{ value: "1.8 h", label: "Median first reply, September" }]}
  hero={<LineChart data={monthly} x="month" y="hours" title="Median hours to first reply, by month" />}
  supporting={[<BarChart key="days" data={byDay} x="day" y="hours" title="Median hours to first reply, weekdays and weekends" />]}
  sources={["Helpdesk export"]}
/>

Props shared by templates

Templates use the same prop names for the same content, so content can be moved from one template to another. Most report-style templates have these props:

PropPurpose
titleThe result of the comparison, as one plain sentence with the number in it.
kickerSmall label above the title.
deckOne-sentence standfirst.
bylineAuthor line.
datePublication date.
sourcesWhere the data comes from, shown in the closing source note. Entries with a url are linked.
periodThe period the data covers.
methodHow the numbers were produced: definitions, adjustments, exclusions.
noteCaveats the reader should know, e.g. "Illustrative data".
creditWho made the piece.
levelHeading level of the title; section headings follow one level down.
maxWidthWidest the piece may get. It is centred in wider containers.
themeTheme override, passed on to everything inside.
modeColour mode, passed on to everything inside.

theme and mode are passed on to everything inside, so one prop changes the theme of the whole page. A preset that is designed for its own surface needs that surface behind the template; see presets and their surfaces.

Layout follows the width of the template's container, not the viewport: a template in a 400 pixel column lays out as it would on a phone. maxWidth limits the width and centres the template in a wider container.

Data inside a template

A chart spec in a slot takes data the way any chart does: inline rows, CSV text, or a URL the browser fetches. In a stored spec, a URL keeps the document small, and the data is fetched each time the page loads.

{
  "type": "bar-chart",
  "data": "/data/energy.csv",
  "transform": [{ "type": "filter", "field": "year", "op": "==", "value": 2024 }],
  "x": "source",
  "y": "twh"
}

Templates that filter several charts together, such as data explorer, take one data prop themselves and share it with the charts inside; those chart specs leave data out. See data for every accepted shape and transform.

Templates for sequences

Three templates show a sequence of blocks, chapters or cards. Visual essay takes an ordered blocks array, where each block has a kind (prose, figure, callout, scrolly, quote, stats, multiples, break) and a bare chart spec counts as a figure. Timeline story takes dated chapters. Story deck takes cards to step or swipe through.

{
  "type": "visual-essay",
  "title": "Solar generation rose from 720 TWh in 2020 to 1,960 TWh in 2024",
  "blocks": [
    { "kind": "prose", "text": "Hydro generated 3,900 TWh in 2024. Wind generated 2,640 TWh." },
    { "kind": "figure", "chart": { "type": "line-chart", "data": "/data/energy.csv", "transform": [{ "type": "aggregate", "groupBy": ["year", "source"], "measures": { "twh": { "op": "sum", "field": "twh" } } }], "x": "year", "y": "twh", "series": "source" } },
    { "kind": "quote", "quote": "Asia added 790 TWh of solar generation between 2020 and 2024.", "attribution": "Grid planner" }
  ]
}

A scrolly block pins its chart while the steps scroll past, with the same rules as Scrolly: no ancestor of the template may clip overflow.

Generating a template spec with a model

A template spec is a good thing to ask a model for. The template has already fixed the layout, so the model only writes the titles, figures and chart specs.

  1. Give it the data, the fact each chart should show and the template's Markdown page, for example /llms/executive-brief.md. The page lists every prop and includes a complete example.
  2. Ask for one JSON object and validate it against /schema/insight-spec.json.
  3. Render it with Insight. An unknown type anywhere in the tree renders an inline alert naming the valid ones, which you can send back to the model.

See for AI agents for the other files published for agents.

Previewing a template

A template is too large for the preview box used for atoms. On each template page the preview scrolls inside its frame, Expand shows it at full height in place, and Full screen opens it alone at /templates/<name>/preview, for example the executive brief. The width, theme and mode controls work in all three.

An infographic page has a different toolbar. The theme menu lists the eight poster themes, a Download PNG button saves the poster, and there is no light and dark switch because a poster paints its own ground.