yr.section
section(
title: str,
summary: str | None = None,
auto_collapse: bool = True,
glyph: str = 'thread',
colour: NamedColour | None = None,
) → SectionGroup output blocks into a mutable, collapsible section.
Sections may contain ordinary output blocks or nested sections. While the
context is open, its title, glyph, and colour may be changed through the
returned section object. The success() and error() methods apply
standard completion appearances without closing the section. In the web UI,
the section may collapse automatically when its context exits.
Parameters
title
type: str
Heading shown in the section header.
summary
type: str | None = None
Optional summary shown for the completed section.
auto_collapse
type: bool = True
Whether the section collapses when it completes.
glyph
type: str = 'thread'
Name of the glyph shown in the section header.
colour
type: NamedColour | None = None
Optional named colour applied to the section heading.
Returns
type: Section
A Section context manager.
Examples
with section("Loading data", glyph="spinner") as current:
load_data()
current.success("Data loaded")