Skip to content

ReferenceAPI

Layouts in code (compose)

Ready-made slide layouts (recipes) and the building blocks they're made of.

Layouts in code (compose).md

Ready-made slide layouts (recipes) and the building blocks they’re made of. The same text agents read through help().

compose(slide, tree, options?: ComposeOptions): ComposeResult

Lays out a tree of rows, columns, grids and boxes on a slide and turns it into ordinary native objects (text boxes, shapes, pictures, tables, charts), positioned and named: compose(slide, <column padding={64} gap={24}>…</column>).

Options: ComposeOptions.

compose(deck.slides.add(), h(KpiCards, { title: "Q3 at a glance", kpis: [{ label: "Revenue", value: "$87M" }] }))
h(node | Recipe, props, ...children)

Plain-function form, for scripts without a JSX build step: h("column", { gap: 16 }, h("text", {}, "Hi")). Components (recipes included) work too: h(TitleSlide, { title: "Q3" }).

h("column", { gap: 16, padding: 64 }, h("text", { className: "text-4xl font-bold" }, "Title"))
compose(slide, h(Agenda, props))

Numbered agenda; the current item stands out.

Option Type Description
items (required) string[]
current number
title string
compose(slide, h(BeforeAfter, props))

Before and after, with an arrow between.

Option Type Description
title (required) string
eyebrow string
before (required) { heading?: string; points: string[] }
after (required) { heading?: string; points: string[] }
compose(slide, h(BigNumber, props))

One number that tells the story.

Option Type Description
value (required) string
label (required) string
context string
eyebrow string
compose(slide, h(ChartTakeaway, props))

A chart with the takeaways beside it.

Option Type Description
title (required) string
eyebrow string
chart (required) Omit&lt;ChartProps, keyof LayoutProps | "categories"&gt; & { categories?: ChartProps["categories"]; format?: string } The chart: type, categories and series, plus any chart option (totals, bins, axes, …); format is short for axes.y.format.
takeaways (required) string[]
figure { value: string; label: string } The one figure the chart is about, large above the takeaways: { value: "3.7%", label: "CPI, September 2026" }. Leave it out when the headline already says it or no single figure leads.
note string The source, period or unit, in small type under the chart.
compose(slide, h(Closing, props))

Closing slide: thank-you or call to action, with contact lines.

Option Type Description
title (required) string
subtitle string
contact string[]
compose(slide, h(ComparisonTable, props))

A comparison or data table with an optional note, and the points to take from it.

Option Type Description
title (required) string
eyebrow string
rows (required) Array&lt;Array&lt;string | number&gt;&gt;
takeaways string[] Up to three points the reader should take from the table: beside a narrow table, under a wide one or when there is one.
note string
compose(slide, h(Faq, props))

Questions and answers in two columns.

Option Type Description
title string
items (required) Array&lt;{ q: string; a: string }&gt;
compose(slide, h(ImageText, props))

A picture beside text (left or right).

Options: Bullet.

Option Type Description
title (required) string
image (required) ImageOptions["source"]
alt (required) string
bullets Bullet[]
body string
side "left" | "right" One of left, right.
eyebrow string
compose(slide, h(KpiCards, props))

Two to four KPI cards with a value, label and change.

Options: Kpi.

Option Type Description
title (required) string
kpis (required) Kpi[]
eyebrow string
note string
compose(slide, h(Matrix2x2, props))

A 2×2 matrix with axis labels.

Options: Quadrant.

Option Type Description
title (required) string
eyebrow string
xLabel (required) string
yLabel (required) string
quadrants (required) [Quadrant, Quadrant, Quadrant, Quadrant]
compose(slide, h(PricingTiers, props))

Pricing tiers; the highlighted tier is emphasized.

Option Type Description
title (required) string
eyebrow string
tiers (required) Array&lt;{ name: string; price: string; period?: string; features: string[]; highlight?: boolean }&gt;
compose(slide, h(ProcessSteps, props))

Numbered process steps as cards.

Option Type Description
title (required) string
eyebrow string
steps (required) Array&lt;{ title: string; text?: string }&gt;
compose(slide, h(ProsCons, props))

Pros and cons in two tinted panels.

Option Type Description
title (required) string
eyebrow string
pros (required) string[]
cons (required) string[]
compose(slide, h(Quote, props))

A customer or expert quote with attribution.

Option Type Description
quote (required) string
author (required) string
role string
compose(slide, h(SectionDivider, props))

Section divider on an accent background.

Option Type Description
title (required) string
number string | number
subtitle string
compose(slide, h(TeamGrid, props))

People with photos (or initials), names and roles.

Option Type Description
title (required) string
eyebrow string
people (required) Array&lt;{ name: string; role: string; photo?: ImageOptions["source"] }&gt;
compose(slide, h(Timeline, props))

Milestones on a horizontal line.

Option Type Description
title (required) string
eyebrow string
steps (required) Array&lt;{ date: string; title: string; text?: string }&gt;
compose(slide, h(TitleBullets, props))

Title and bullet points (with optional sub-points).

Options: Bullet.

Option Type Description
title (required) string
bullets (required) Bullet[]
eyebrow string
compose(slide, h(TitleSlide, props))

Opening slide: large title, subtitle and a date, over an accent rule.

Option Type Description
title (required) string
subtitle string
eyebrow string
date string
figures Array&lt;{ value: string; label: string }&gt; Up to four headline figures along the bottom, for a short briefing whose cover also gives the answer: [{ value: "3.7%", label: "CPI, Sep 2026" }]. A deck still opens with this cover.
compose(slide, h(TwoCharts, props))

Two charts side by side, each with its own title, and the points to take from them.

Option Type Description
title (required) string
eyebrow string
left (required) Omit&lt;ChartProps, keyof LayoutProps | "categories"&gt; & { categories?: ChartProps["categories"]; format?: string } Each chart: its title, type, categories and series, plus any chart option; format is short for axes.y.format.
right (required) Omit&lt;ChartProps, keyof LayoutProps | "categories"&gt; & { categories?: ChartProps["categories"]; format?: string }
takeaways string[] Up to three points, under the charts.
note string
compose(slide, h(TwoColumns, props))

Two columns of points, each with an optional heading.

Options: Bullet.

Option Type Description
title (required) string
eyebrow string
left (required) { heading?: string; bullets: Bullet[] }
right (required) { heading?: string; bullets: Bullet[] }
h("box", props, ...children)

A panel: one child with padding and visual props (fill, line, radius, shadow).

Option Type Description
fill string
line string | LineOptions
radius number | string
shadow string
geometry ShapeOptions["geometry"]
className string
alt string
gap Gap
padding Spacing
justify Justify Along the main axis.
align Align Across the main axis. Default “stretch”.
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
h("br", props)

A line break inside a paragraph.

h("chart", props, ...children)

A native chart laid out in the tree: type plus ChartOptions except frame, e.g. h(“chart”, { type: “line”, categories, series }).

Option Type Description
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
type (required) ChartType
alt string
style string | TextStyle Default text for the chart: font, size, color.
border string | LineOptions
categories Array&lt;string | number | string[]&gt; Category labels (not used by scatter and bubble charts). Treemap and sunburst take a path per point, outermost first: [["Enterprise", "EMEA"], ["SMB"]]. Box & whisker: one per value.
series (required) ChartSeriesInput[]
title string | { text: string; style?: string | TextStyle; overlay?: boolean }
legend false | LegendPosition | { position?: LegendPosition; overlay?: boolean; style?: string | TextStyle } Position, false to hide, or options. Default bottom.
dataLabels boolean | DataLabelsInput Labels on every series. true = values.
stacked boolean | "percent" Column, bar, line and area charts: stack series, or stack to 100%.
axes { x?: AxisInput; y?: AxisInput; y2?: AxisInput } y2: the secondary value axis on the right, for series with axis: “secondary”.
gap number Space between bar groups, percent of a bar’s width (0–500).
overlap number Bar overlap within a group, percent (-100–100).
holeSize number Doughnut hole, percent of the diameter (10–90).
firstSliceAngle number Pie and doughnut rotation in degrees.
varyColors boolean A different color for every point.
radarStyle "marker" | "filled" | "lines" One of marker, filled, lines.
blanks "gap" | "zero" | "span" How gaps draw: leave a gap, drop to zero, or connect across. One of gap, zero, span.
background string
plotBackground string
upDownBars boolean Stock charts with four series (open, high, low, close).
highLowLines boolean
totals number[] Waterfall: indexes of the points that are totals (full bars from zero), e.g. [0, 4].
connectorLines boolean Waterfall: lines joining the bars (default true).
parentLabels "overlapping" | "banner" | "none" Treemap: parent labels (default “overlapping”). One of overlapping, banner, none.
bins number | { count?: number; width?: number } Histogram: the number of bins, or their width (default: automatic).
threeD boolean Column, bar, line, area and pie charts drawn in 3D. 3D distorts values: prefer 2D.
split { by: "position" | "value" | "percent" | "custom"; value?: number; points?: number[]; /** Size of the second plot, percent of the first (5–200, default 75). */ secondSize?: number } Pie-of-pie and bar-of-pie: which points go to the second plot. By “position” (the last value points), “value” (points below value), “percent” (below value percent of the whole) or “custom” (the points listed). Default: Office’s automatic split.
wireframe boolean Surface and contour charts: lines only, no fill.
boxWhisker { /** A line through the means (default false). */ meanLine?: boolean; /** An x at each mean (default true). */ meanMarkers?: boolean; /** Points beyond the whiskers (default true). */ outliers?: boolean; /** Every value as a point (default false). */ innerPoints?: boolean; /** Median method (default "exclusive"). */ quartiles?: "exclusive" | "inclusive" } Box & whisker: what to draw besides the boxes.
h("column", props, ...children)

Children top to bottom (a flex column): gap, padding, justify, align, wrap.

Option Type Description
wrap boolean Wrap children onto new lines when they do not fit.
gap Gap
padding Spacing
justify Justify Along the main axis.
align Align Across the main axis. Default “stretch”.
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
h("grid", props, ...children)

Children in a grid of column (and row) tracks; colSpan on a child spans columns.

Option Type Description
columns (required) number | Array&lt;number | string&gt; Column tracks: px, “2fr”, “auto”, or a count of equal columns.
rows Array&lt;number | string&gt; Row tracks (default: auto, as tall as the tallest cell).
gap Gap
padding Spacing
justify Justify Along the main axis.
align Align Across the main axis. Default “stretch”.
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
h("image", props, ...children)

A picture laid out in the tree; takes ImageOptions except frame (it keeps its aspect ratio).

Option Type Description
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
alt string Alternative text. Strongly recommended.
line string | LineOptions
shadow string
radius number | string Corner radius in px or a token; clips to roundRect.
rotation number Degrees, clockwise.
source (required) ImageSource
fit "contain" | "cover" | "fill" contain (default): shrink the frame to the image’s aspect ratio, centered. cover: fill the frame and crop the overflow evenly. fill: stretch to the frame. One of contain, cover, fill.
crop { left?: number; top?: number; right?: number; bottom?: number } Extra crop applied first, as fractions (0.1 = 10%) of the source image.
clip PresetGeometry Clip the picture to a preset shape, e.g. “ellipse”.
h("paragraph", props, ...children)

A paragraph inside <text>: bullets, level, spacing and alignment.

Option Type Description
style string | TextStyle
className string
bullet boolean | string true for “•”, a character, “number”, or false.
level number 0–8
align TextStyle["align"]
spaceBefore number
spaceAfter number
lineHeight number | string
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
h("row", props, ...children)

Children left to right (a flex row): gap, padding, justify, align, wrap.

Option Type Description
wrap boolean Wrap children onto new lines when they do not fit.
gap Gap
padding Spacing
justify Justify Along the main axis.
align Align Across the main axis. Default “stretch”.
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
h("rule", props, ...children)

A line along the parent’s cross axis: horizontal in a column, vertical in a row.

Option Type Description
line string | LineOptions
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
h("run", props, ...children)

A run of text inside a paragraph with its own style (bold, color, link).

Option Type Description
style string | TextStyle
bold boolean
italic boolean
underline boolean
color string
link string
h("shape", props, ...children)

A native shape (any preset geometry) laid out like a box; takes ShapeOptions except frame.

Option Type Description
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
geometry Geometry Any ECMA-376 preset (rect, roundRect, ellipse, rightArrow, star5, …), “textbox” or “custom”. Default “rect”.
alt string Alternative text for screen readers.
fill string Color, gradient (“linear(135deg, white, sky-100)”), pattern or “none”.
line string | LineOptions Stroke string (“2px dashed slate-300”) or options.
shadow string Shadow token (shadow-sm … shadow-2xl) or “x y blur color”.
radius number | string Corner radius in px or a token (rounded-xl). Turns rect into roundRect.
adjust Record&lt;string, number&gt; Raw preset adjust values, e.g. { adj: 16667 } (1/100000 of the shorter side).
rotation number Degrees, clockwise.
flipH boolean
flipV boolean
className string Tailwind-style visual classes; explicit options win.
textStyle string | TextStyle Default style for every run: style string or object.
textBox TextBoxOptions
paths CustomPath[] Required when geometry is “custom”.
h("spacer", props, ...children)

Empty space; grows by default.

Option Type Description
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
h("span", props, ...children)

Same as <run>.

Option Type Description
style string | TextStyle
bold boolean
italic boolean
underline boolean
color string
link string
h("stack", props, ...children)

Layers on top of each other: the first child sets the size, later ones cover it.

Option Type Description
gap Gap
padding Spacing
justify Justify Along the main axis.
align Align Across the main axis. Default “stretch”.
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
h("table", props, ...children)

A native table laid out in the tree; takes TableOptions except frame.

Option Type Description
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.
alt string
textStyle string | TextStyle Style for body cells.
rows (required) Cell[][] Rows of cells, HTML-style: a cell with colSpan/rowSpan covers later positions, and the covered positions are left out of later cells in that row or the rows below.
columns Array&lt;number | string&gt; Column widths in px or fractions (“2fr”). Default: by content, so short columns stay narrow and long text gets the room (no column narrower than its longest word, where the width allows).
header boolean | number Number of header rows (default 1). false = 0.
style TableStylePreset Default “grid”.
headerFill string
headerColor string
bandFill string Fill for alternating body rows.
border string Border stroke used by the preset, e.g. “1px solid slate-300”.
headerStyle string | TextStyle Style for header cells (merged over textStyle).
padding number | { x: number; y: number } Cell padding in px: one value or { x, y }. Default { x: 12, y: 8 }.
rowHeight number Minimum row height in px. Default: frame height divided by the row count.
rowHeights number[] Each row’s height in px, overriding rowHeight (compose sets these from the measured text).
numberAlign TextStyle["align"] Alignment for columns whose body cells are all numbers, header included. Default “right”.
h("text", props, ...children)

A native text box sized to its text: plain children, <paragraph> and <run>, styled with className or style.

Option Type Description
style string | TextStyle
className string
align TextStyle["align"] Horizontal alignment of every paragraph.
valign TextBoxOptions["valign"]
textBox TextBoxOptions
fill string Background of the text box (a fill color or gradient).
line string | LineOptions
radius number | string
name string Role name, kept on the native object (e.g. “title”, “kpi-revenue”).
width Size
height Size
minWidth number
maxWidth number
minHeight number
maxHeight number
matchHeight string Nodes with the same key take the height of the tallest, so side-by-side cards line up: when one card’s label wraps to two lines, every card’s value moves down with it (e.g. “kpi-label”).
grow number Share of the free space along the parent’s direction (flex-grow).
shrink number
alignSelf Align
margin Spacing
colSpan number Grid cells: columns this child spans.