Layout API

ww.columns(spec=2)

Create a multi-column layout.

spec : int | list[int]
Number of equal columns, or list of relative widths.

Returns a ColumnSet. Access individual columns with [index] and use as context managers.

cols = ww.columns([2, 1])
with cols[0]:
    ww.text("Wide column")
with cols[1]:
    ww.text("Narrow column")

ww.tabs(labels)

Tabbed content container.

labels : list[str]
Tab labels.

Returns a TabSet. Access individual tabs with [index].

ts = ww.tabs(["Tab A", "Tab B"])
with ts[0]:
    ww.text("Content A")
with ts[1]:
    ww.text("Content B")

ww.accordion(title, open=False)

Collapsible section. Use as a context manager.

title : str
Accordion header text.
open : bool
Start expanded. Default False.

ww.sidebar()

Side panel. Use as a context manager. Content inside appears in a fixed sidebar.

ww.card(title=None)

Card container with optional title. Use as a context manager.

ww.grid(template="1fr 1fr")

CSS Grid container.

template : str
CSS grid-template-columns value.

ww.modal(title)

Modal dialog overlay. Use as a context manager.

title : str
Modal title.

ww.nav(items)

Navigation bar.

items : list[dict]
List of {"href": "...", "text": "..."} dicts.
ww.nav([
    {"href": "/", "text": "Home"},
    {"href": "/docs", "text": "Docs"},
])