PANELITH DOCS Open the interactive docs ↗

Reference · Panelith 0.1.0 · plain HTML edition; the interactive edition has search and live examples

Widgets

What each built-in widget reads from the pane's state and which events it emits, and the panelith.widgets builders that make those states.

The widgets#

Widget Reads from the state Emits widget_options Builder
markdown markdown (or text); anchor, anchor_key code {action, demo, lang, attrs, code} from a fence's Show; link {href} for a relative link; anchor {id} from a heading's # link allow_html, highlight, copy widgets.markdown(text)
html html, or src (an iframe) with title nothing
text text; with sub-tabs buffers {subtab id: text}; placeholder state (the edit, debounced) mono, placeholder
keyvalue items [{key, value, label?, mono?}] or a plain object; empty_text nothing widgets.keyvalue(mapping | pairs)
table columns [{key, label?, width?, grow?, mono?} | str]; rows [{...}] (_tone tints a row); empty_text row {row} widgets.table(rows, columns=…), widgets.column(...)
form fields [{name, label?, type?, options?, value?, placeholder?, rows?, help?, min?, max?, step?}]; title, submit_label, message, live, reset submit {values}; change {name, value} when live
output status idle | running | done | error; stdout, stderr, result, title, hint nothing widgets.output(stdout=, stderr=, status=, result=, title=)
blocks blocks [...], direction, scroll, align, tags (from Pane.view) whatever the buttons, chips, cards, grids and countdowns were given panelith.blocks
<plugin> whatever the module reads whatever it emits widget_options as given an ES module in App.plugins (Plugins)

panelith.widgets#

column#

column(key: str, label: str | None = None, *, width: int | None = None, grow: bool | None = None, mono: bool | None = None) -> dict[str, Any]

One table column: key into each row, an optional header label, a fixed pixel width, grow to take the spare width, mono for tabular figures.

table#

table(rows: Iterable[Any], columns: Iterable[ColumnSpec] | Mapping[str, str] | None = None, *, empty_text: str | None = None, exclude: Iterable[str] = ()) -> dict[str, Any]

The table widget's state.

Argument Meaning
rows dicts, namedtuples, dataclasses or plain objects; each becomes a row.
columns key strings, column() dicts, or a {key: label} mapping; omitted, every key seen across the rows becomes a column in first-seen order.
empty_text what the widget says when there are no rows.
exclude keys to leave out when the columns are inferred.

keyvalue#

keyvalue(items: Mapping[str, Any] | Iterable[tuple[str, Any]] | Iterable[Mapping[str, Any]]) -> dict[str, Any]

The keyvalue widget's state from a mapping, (key, value) pairs or ready-made {"key": ..., "value": ...} dicts; insertion order is kept.

markdown#

markdown(text: str) -> dict[str, Any]

The markdown widget's state.

output#

output(*, stdout: str = '', stderr: str = '', status: str | None = None, result: Any = None, title: str | None = None) -> dict[str, Any]

The output widget's state.

Argument Meaning
stdout text shown in monospace.
stderr text shown in monospace, in the error colour.
status idle, running, done or error; defaults to done when there is any text, idle otherwise.
result any JSON value, pretty-printed under the text.
title a label for the header line.