Skip to content
InsightCharts

Search

Search guides and components

Story deck

A 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.

Use when
Use it for a short sequence read on a phone, such as a “year in review”. Each card should be readable in a couple of seconds. State the main fact with its number on the title card. Put one fact on each later card, as a number or as one chart with one highlighted mark under a headline that states the fact. Use five to ten cards. End with a closing card and the sources. Charts in cards should have few data points and direct labels, with no legend.
Avoid when
Findings that need two exhibits in view at once (use executive brief). A single shareable image (use social card). Dense charts or long paragraphs, because a card has little room. One chart that changes step by step (use scrolly chart in steps mode).

Preview

A template is a whole page, so the preview scrolls inside its frame. Expand it to read it in place, or open it full screen.

Full screen

Your 2024 on the road

You ran 1,842 km in 2024

That was 23% more than in 2023. You ran 187 times.

Riverside Runners · member report

Card 1 of 7

Source: Club activity tracker. Data: 1 January to 31 December 2024. Note: Illustrative data.

Composition

Built from

The story deck template is assembled from 7 atoms. Any slot also takes any other component.

Atoms

7

Compares a value across categories with bars from a zero baseline.

A featured statistic with its label, change and the context that gives it meaning.

Shows how one or more values change over time or another ordered dimension.

A readable block of narration at a 45-75 character measure, for the text between charts.

Draws bars around a circle for data that repeats in a cycle, such as hours of the day or months of the year.

A sourcing footer for a whole piece: sources with optional links, the period covered, method, caveats and credit.

Installation

$ pnpm dlx shadcn@latest add @insightcharts/story-deck

The CLI copies the source into your project and needs the @insightcharts registry in components.json; see installation. With the package, import it by name:

import { StoryDeck } from "insightcharts";

Examples

Education: landscape cards

City libraries · 2024 in review

Digital loans were higher than print loans in 2024 for the first time

The five branches had 908,000 visits. That is 91% of the 2019 total.

Card 1 of 5

Source: City library service annual return. Note: Illustrative data.

Stacked, auto height

Distance

Kilometres run in 2024
1,842
+23% vs 2023

“I started running before work in the spring.”

Club member

Note: Illustrative data.

Props

PropTypeDefaultDescription
cardsrequiredCard[]The cards in order. Each has a kind: title { title, deck?, byline? }; stat { value, label, context?, delta?, deltaLabel?, upIsGood?, format?, text? }; chart { title, chart, text? }; quote { quote, attribution?, role? }; closing { title, text?, points?, action?: { label, href } }. Any card takes kicker, tone: "surface" | "inverse" | "accent" and id.
labelstringAccessible name of the deck. Defaults to the first card's title.
aspect"auto" | "9:16" | "4:5" | "1:1" | "16:9""4:5"Shape of every card. auto lets cards take the height their content needs. 16:9 falls back to 4:5 in containers under 520px.
layout"pager" | "stack""pager"pager shows one card at a time (swipe, buttons, dots, arrow keys, Home/End). stack lists every card in a column.
startAtnumber0Card shown first (zero-based).
onCardChange(index: number) => voidCalled when the visible card changes.
maxWidthnumberWidest a card is drawn, in px. Default 440 (400 for 9:16, 520 for 1:1, 840 for 16:9). Type and spacing scale with the card.
previousLabelstring"Previous"Label of the previous button.
nextLabelstring"Next"Label of the next button.
sourcesstring | { name, url? } | (string | { name, url? })[]Where the data comes from, shown in the closing source note. Entries with a url are linked.
periodstringThe period the data covers.
methodstringHow the numbers were produced: definitions, adjustments, exclusions.
notestringCaveats the reader should know, e.g. "Illustrative data".
creditstringWho made the piece.
level1 | 2 | 3 | 4 | 5 | 61Heading level of the title; section headings follow one level down.
themeThemeInputTheme override, passed on to everything inside.
mode"auto" | "system" | "light" | "dark""auto"Colour mode, passed on to everything inside.