mosaic.grids constructors
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.
cell
Creates a structural leaf cell in a Mosaic grid tree.
A cell is where slide content lands. Its id must be a non-empty string, unique within the tree, and may not be one of the reserved plane ids background or foreground. Pass it positionally or through id:, but not both.
#mosaic.grids.rows(
mosaic.grids.track(auto, mosaic.grids.cell("header")),
mosaic.grids.cell("body"),
)Styling
Cells are structural only. Every rendered cell is labeled <mosaic-cell-ID>, so appearance comes from native Typst rules. Use a set rule for properties of the content and mosaic.surface for the cell’s own block.
#show label("mosaic-cell-body"): set text(size: 0.9em)
#show label("mosaic-cell-body"): mosaic.surface(fill: luma(240))cell(
..identifier: arguments,
content: content | none = none,
id: str | none = none,
inset: auto | length | relative | dictionary = auto
) -> dictionary..identifier- Type:
arguments - The cell id, as the sole positional argument. Give it here or through
id:.
- Type:
content- Type:
contentornone - Default:
none - Fixed content rendered in place of a slide body, so the surrounding slide supplies no block for this cell.
- Type:
id- Type:
strornone - Default:
none - The cell id, when it is not passed positionally.
- Type:
inset- Type:
autoorlengthorrelativeordictionary - Default:
auto - Native Typst inset applied inside the cell’s labeled block.
autouses thespacing.insetconfigured onsetup.
- Type:
track
Associates an explicit native track size with one child of columns or rows.
Unwrapped children of a split take 1fr and therefore share the space evenly. Wrap one in track to give it a size of its own.
#mosaic.grids.rows(
mosaic.grids.track(auto, "header"), // as tall as its content
"body", // 1fr, taking the rest
mosaic.grids.track(2em, "footer"), // a fixed strip
)The wrapper is temporary: columns or rows unwraps it while constructing the split, so a track value never appears in a resolved tree.
track(size: auto | length | ratio | relative | fraction, child: str | dictionary) -> dictionarysize- Type:
autoorlengthorratioorrelativeorfraction - Native Typst grid track size.
autosizes to the child’s content, a length or ratio fixes it, and a fraction such as2frtakes a share of what remains.
- Type:
child- Type:
strordictionary - The child to size: a string cell id, or a canonical Mosaic grid node built with
cell,columns, orrows.
- Type:
columns
Splits the available width, arranging its children as columns.
Children may be given in three forms, freely mixed:
- A string, which is shorthand for
cell(id). - A node built with
cell,columns, orrows, so splits nest to any depth. - Any of those wrapped in
trackto give it an explicit track size.
Each unwrapped child receives a 1fr column, so an unadorned columns divides the width evenly.
#mosaic.grids.columns(
gutter: 1em,
stroke: 0.5pt + gray,
mosaic.grids.track(2fr, "left"),
"right",
)columns(
gutter: auto | length | ratio | relative | fraction = 0pt,
stroke: none | stroke = none,
..children: arguments
) -> dictionarygutter- Type:
autoorlengthorratioorrelativeorfraction - Default:
0pt - Native Typst track size used between adjacent columns.
- Type:
stroke- Type:
noneorstroke - Default:
none - Stroke drawn along each interior column boundary, centered in the gutter. A gutter of
0ptleaves the stroke sitting directly between the columns.
- Type:
..children- Type:
arguments - The columns: string cell ids, Mosaic grid nodes, or values wrapped with
track. At least one is required.
- Type:
rows
Splits the available height, arranging its children as rows.
Children take the same three forms as in columns: a string cell id, a Mosaic grid node, or either wrapped in track. Each unwrapped child receives a 1fr row.
#mosaic.grids.rows(
gutter: 0.7em,
mosaic.grids.track(auto, "header"),
mosaic.grids.columns(gutter: 1em, "left", "right"),
mosaic.grids.track(auto, "footer"),
)rows(
gutter: auto | length | ratio | relative | fraction = 0pt,
stroke: none | stroke = none,
..children: arguments
) -> dictionarygutter- Type:
autoorlengthorratioorrelativeorfraction - Default:
0pt - Native Typst track size used between adjacent rows.
- Type:
stroke- Type:
noneorstroke - Default:
none - Stroke drawn along each interior row boundary, centered in the gutter.
- Type:
..children- Type:
arguments - The rows: string cell ids, Mosaic grid nodes, or values wrapped with
track. At least one is required.
- Type: