Table#
- class marimo.ui.table(data: Sequence[str | int | float | bool | MIME | None] | Sequence[Dict[str, str | int | float | bool | MIME | None]] | 'pd.DataFrame', pagination: bool | None = None, selection: Literal['single', 'multi'] | None = 'multi', *, label: str = '', on_change: Callable[[List[object]], None] | None = None)#
A table component.
Example.
table = mo.ui.table( data=[ {'first_name': 'Michael', 'last_name': 'Scott'}, {'first_name': 'Dwight', 'last_name': 'Schrute'} ], label='Users' )
# df is a Pandas dataframe table = mo.ui.table( data=df, # use pagination when your table has many rows pagination=True, label='Dataset' )
Attributes.
value
: the selected values, orNone
if no selection.data
: the table data
Initialization Args.
data
: a list of values representing a column, or a list of dicts where each dict represents a row in the table (mapping column names to values). values can be primitives (str
,int
,float
,bool
, orNone
) or Marimo elements: e.g.mo.ui.button(...)
,mo.md(...)
,mo.as_html(...)
, etc.pagination
: whether to paginate; ifFalse
, all rows will be shown defaults toTrue
when above 10 rows,False
otherwiseselection
: ‘single’ or ‘multi’ to enable row selection, orNone
to disablelabel
: text label for the elementon_change
: optional callback to run when this element’s value changes
Public methods
Inherited from
UIElement
form
([label])Create a submittable form out of this
UIElement
.Inherited from
Html
batch
(**elements)Convert an HTML object with templated text into a UI element.
center
()Center an item.
right
()Right-justify.
left
()Left-justify.
callout
([kind])Create a callout containing this HTML element.
Public Data Attributes:
data
Inherited from
UIElement
value
The element’s current value.
Inherited from
Html
text
A string of HTML representing this element.