Display API

Display elements render read-only content on the page. All functions return an Element with an .update(content) method.

ww.title(text)

Page title rendered as an <h1>.

text : str
The title text.
ww.title("Dashboard")

ww.heading(text, level=2)

Section heading (<h2><h6>).

text : str
Heading text.
level : int
Heading level, 2–6. Default 2.

ww.text(content)

Plain text paragraph.

content : str
Text content.

ww.markdown(md_string)

Render Markdown content.

md_string : str
Markdown-formatted string.

ww.code(code_string, lang="python")

Syntax-highlighted code block.

code_string : str
Source code.
lang : str
Language for highlighting. Default "python".

ww.html(raw_html, raw=False)

Render raw HTML. When raw=True, content is inserted without sanitization.

raw_html : str
HTML string.
raw : bool
Skip sanitization. Default False.

ww.image(src, alt="", width=None)

Display an image.

src : str
Image URL or data URI.
alt : str
Alt text. Default "".
width : int | str | None
Width (pixels or CSS string).

ww.divider()

Horizontal rule separator. No parameters.

ww.table(data, sortable=False, searchable=False, paginate=None)

Render a data table. Accepts list-of-lists, list-of-dicts, or a pandas DataFrame.

data
Table data.
sortable : bool
Enable column sorting. Default False.
searchable : bool
Enable search filter. Default False.
paginate : int | None
Rows per page. None disables pagination.

ww.metric(label, value, delta=None, delta_color=None)

KPI metric card.

label : str
Metric label.
value : str
Metric value.
delta : str | None
Change indicator (e.g. "+12%").
delta_color : str | None
Color for delta text.

ww.json(data, collapsed=1)

Interactive JSON tree viewer.

data
JSON-serializable data.
collapsed : int
Default nesting depth to collapse. Default 1.

ww.progress(value=0, max_val=100)

Progress bar. Returns a handle with .update(n).

value : int
Current value. Default 0.
max_val : int
Maximum value. Default 100.

ww.toast(message, type="info", duration=3000)

Transient notification toast. Returns a bwserve call message (not an Element).

message : str
Toast text.
type : str
"info", "success", "warning", or "error".
duration : int
Display time in ms. Default 3000.