mo.ui.table
Display data in an interactive, searchable table.
Signature
mo.ui.table(
data: Sequence[dict[str, Any]] | dict[str, Sequence[Any]],
selection: Literal["single", "multi"] | None = None,
pagination: bool = True,
page_size: int = 10,
*,
label: str = "",
on_change: Callable[[list[dict[str, Any]]], None] | None = None
)
Parameters
data
Sequence[dict] | dict[str, Sequence]
required
Table data as list of dicts or dict of lists
Enable row selection (single or multiple)
Markdown label for the table
Examples
import marimo as mo
# Basic table
data = [
{"name": "Alice", "age": 30, "city": "NYC"},
{"name": "Bob", "age": 25, "city": "SF"},
{"name": "Charlie", "age": 35, "city": "LA"},
]
table = mo.ui.table(data)
table
# Table with selection
selectable_table = mo.ui.table(
data,
selection="multi",
label="**Select rows:**"
)
mo.md(f"Selected: {selectable_table.value}")
# Column-oriented data
data_cols = {
"Name": ["Alice", "Bob", "Charlie"],
"Age": [30, 25, 35],
"City": ["NYC", "SF", "LA"]
}
table = mo.ui.table(data_cols, page_size=5)
For dataframe-specific features, use mo.ui.dataframe() instead.