Document setup
The overview below links to each definition. Function definitions show signatures with parameter and return types; variables show their declared types. Descriptions and defaults follow.
setup
Applies Mosaic’s presentation defaults and compiles headings and slide commands into pages.
Install it as a document-wide show rule. Everything after it is presentation source: level-two headings become slides, and mosaic.slide commands become slides.
#import "@preview/mosaic:0.0.1" as mosaic
#show: mosaic.setup.with(
title: [Tree-based slide grids],
authors: [Ada Lovelace],
date: [2026-08-03],
)
#mosaic.slide(layout: "title")
== First slide
Body content.Deck metadata
title, subtitle, authors, and date are the deck’s canonical identity. They are written to Typst’s standard document metadata, stored in Mosaic’s rendering settings, and emitted as one queryable <mosaic-deck-metadata> record. Setup never creates a title slide by itself; mosaic.slide(layout: "title") inherits these values wherever the title layout’s own field is auto.
Partial overrides
colors, cells, spacing, and layouts are all partial: keys you omit keep the active theme’s value rather than reverting to a bare default. That is what lets a deck adjust one accent color or one layout without restating the theme.
Themes
This is the Default facade’s setup. A themed facade such as mosaic.themes.metropolis exposes the same signature with different defaults, and may add its own options on top. See theme.setup for binding a custom theme definition.
setup(
body: content,
paper: str = "16-9",
title: content | str | none = none,
subtitle: content | str | none = none,
authors: content | str | array = (),
date: content | str | none = none,
colors: dictionary = (:),
cells: dictionary = (:),
background: content | str | none = none,
foreground: content | str | none = none,
spacing: dictionary = (:),
overflow: str = "off",
layouts: dictionary = (:),
handout: bool = false,
output: str = "slides",
frozen-counters: array = (),
frozen-states: array = ()
) -> contentbody- Type:
content - The document body captured by the show rule.
- Type:
paper- Type:
str - Default:
"16-9" Slide aspect ratio.
"16-9": widescreen, the default."4-3": traditional projector.
- Type:
title- Type:
contentorstrornone - Default:
none - Canonical deck title. Title layouts inherit it when their
titleisauto.
- Type:
subtitle- Type:
contentorstrornone - Default:
none - Canonical deck subtitle. Title layouts inherit it when their
subtitleisauto.
- Type:
authors- Type:
contentorstrorarray - Default:
() Canonical deck authorship. Title layouts inherit it when their own
authorsisauto. A name on its own is enough, so this reads liketitleandsubtitlein the common case:authors: [Ada Lovelace] authors: ([Ada Lovelace], [Charles Babbage])Wrap a name in
layouts.authorwhen it carries affiliations, an ORCID iD, or a contact address. Names and records mix in one array:authors: ( mosaic.layouts.author( [Ada Lovelace], affiliations: ([Analytical Society],), email: "ada@example.org", corresponding: true, ), [Charles Babbage], )
- Type:
date- Type:
contentorstrornone - Default:
none - Canonical display date. Title layouts inherit it when their
dateisauto.
- Type:
colors- Type:
dictionary - Default:
(:) Partial semantic color overrides layered over the active theme. Omitted roles keep the theme’s value.
canvas: the slide page behind everything else.surface: raised panels, such as component frames and callouts.text: ordinary body text.muted: subtitles, captions, and other fine print.line: rules, borders, and other drawn separators.accent: the deck’s one emphatic color.
colors: (accent: rgb("#0072B2"))
- Type:
cells- Type:
dictionary - Default:
(:) Partial fallback content keyed by cell ID, used whenever a slide leaves that cell empty. Every key names a grid cell, for example
footerorbody; the full-slide planes have their own options below.A slide’s explicit content overrides these values, and
noneon the slide suppresses a configured default. Defaults targeting cells absent from a resolved grid are ignored, so one footer default is safe across layouts that have no footer.cells: (footer: align(right, mosaic.components.progress()))
- Type:
background- Type:
contentorstrornone - Default:
none The deck’s background plane, drawn behind the grid on every slide. A slide inherits it unless it passes its own
background:, ornoneto suppress it. The plane takes no space away from the grid.background: mosaic.components.image(path("paper.webp"))
- Type:
foreground- Type:
contentorstrornone - Default:
none The deck’s foreground plane, drawn over the grid on every slide. Ordinary home for a logo, a slide number, or a progress indicator.
foreground: place(bottom + right, mosaic.components.progress())
- Type:
spacing- Type:
dictionary - Default:
(:) Partial overrides for the grid geometry the layouts measure with. Omitted keys keep the theme’s value.
inset: padding inside a cell, default1.25em.gap: space between grid regions, default0.7em.compact-gap: the tighter space inside stacked metadata, default0.35em.
Typographic rhythm is not here. Heading spacing and list spacing are ordinary
showandsetrules owned by the theme, so change them with native rules aftersetupor in your own theme’sapply.
- Type:
overflow- Type:
str - Default:
"off" What to do when a cell’s content is taller than the cell.
Observation measures every cell on every frame, which roughly doubles the layout work a deck does, so it is off by default and switched on for a deliberate checking pass rather than left on while you write.
"off": observe nothing. The default."record": emit queryable<mosaic-overflow-warning>metadata and keep compiling. Typst gives a package no warning channel, so nothing is printed; this mode is for tooling that reads the records itself."error": emit the same metadata and fail the compile, naming every offending cell. Run this before presenting, so a build stops rather than shipping a clipped slide.
- Type:
layouts- Type:
dictionary - Default:
(:) Partial named-layout overrides. Omitted names keep the active theme’s layout.
content: the ordinary slide layout, also used by automatic level-two-heading slides.title: used byslide(layout: "title").section: used byslide(layout: "section")and by automatic level-one heading slides.
Each value is either a deferred
mosaic.layouts.*value or a low-levelmosaic.grids.*tree. Note that this option is distinct from thecells:option above, which supplies inherited cell content rather than structure.layouts: ( content: mosaic.layouts.content(variant: "header-body", columns: 2), )
- Type:
handout- Type:
bool - Default:
false - Whether to emit only the final frame of each logical slide, collapsing every incremental reveal into one page for printing.
- Type:
output- Type:
str - Default:
"slides" Which document to render.
"slides": the presentation itself."speaker": each frame above the notes that apply to it."notes": the notes alone, without the slide image.
- Type:
frozen-counters- Type:
array - Default:
() Counters restored to their pre-slide values before each continuation frame, so content repeated across the frames of one logical slide advances them once rather than once per frame.
frozen-counters: (counter(figure.where(kind: image)),)
- Type:
frozen-states- Type:
array - Default:
() - States restored to their pre-slide values before each continuation frame, the
statecounterpart offrozen-counters.
- Type: