Page

One output page, for an image, PDF page, or presentation slide. Page accepts zero or one content element, along with the common sizing and inherited style props. Put multiple elements inside a stack or Group.

Use Page on its own, or put several Pages inside a Document. Its layout is independent of the output format. Page replaces the former Svg element. Slide extends Page with a title and body layout, so it can be used directly inside Document without an additional Page wrapper.

PropertyDefaultMeaning
children—One content element, optionally absent
themeInherited, initially "light"Palette inherited by all content
backgroundnoneExplicit viewport paint; independent of the theme
width / heightNaturalPreferred viewport dimensions in pixels: px(800) or "800px"
aspect—Preferred viewport width/height ratio
min-width / min-height—Minimum viewport dimensions
max-width / max-height—Maximum viewport dimensions; uniformly shrink overflowing content on hugging axes
Typography and paintInheritedStyle inherited by content

An explicit width or height establishes that viewport axis. Unspecified axes hug the child's measured size. There is no implicit 500px or 1000px canvas: a completely natural Square produces a small natural viewport.

Some elements reserve an outset outside their own box, such as a Plot with bounds="frame". A hugging axis grows to include it; an established axis keeps its size and clips it like any other overflow.

Page gives its content advisory offers on its established axes, rather than forcing every child to occupy the whole viewport. Consequently, a tall Page does not make a VStack's children grow. Use explicit stack sizing.

The viewport establishes percentage references for its direct content. Its fragment has a rectangular clip, and serialized SVG hides viewport overflow. Overflow is still retained in the fragment for inspection.

On an unspecified axis, a maximum first provides a layout offer. Text reflows at the offered width; if the resulting figure exceeds either maximum, Page scales the complete figure down uniformly. Width and height shrink together, including fonts, strokes, and reserved outsets. Smaller figures keep their natural sizes. Max props on ordinary elements retain their allocation-only meaning.

An explicit width or height, including an exact parent request, keeps that axis's allocation and clipping behavior. Advisory available(...) requests without max props do not scale anything. A width-only page therefore reflows and grows naturally in height.

An explicit aspect uses the common sizing rules. width={px(320)} aspect={2} creates a 320×160 viewport before laying out its content. With neither dimension established, the viewport grows its measured size to the ratio without scaling the drawing. Two fixed dimensions and min/max limits take precedence.

Set theme="dark" for foregrounds suited to a dark surface. Descendants use the palette for text, strokes, grids, plot borders, and legend badges and borders. Explicit paint props override the defaults. See Themes.

Title remains a render_svg option. Its background option paints behind the entire fragment. Themes do not paint backgrounds; Page's background prop can supply an explicit viewport background in source. The CLI wraps a bare layout element in Page automatically; evaluate does not. Document already contains its own explicit Pages.