Multiselect¶
- class marimo.ui.multiselect(options: Sequence[str] | dict[str, Any], value: Sequence[str] | None = None, *, label: str = '', on_change: Callable[[List[object]], None] | None = None, full_width: bool = False, max_selections: int | None = None)¶
A multiselect input.
Example.
multiselect = mo.ui.multiselect( options=["a", "b", "c"], label="choose some options" )
Or from a dataframe series:
multiselect = mo.ui.multiselect.from_series(df["column_name"])
Attributes.
value: the selected values, orNoneif no selectionoptions: a dict mapping option name to option value
Initialization Args.
options: sequence of text options, or dict mapping option name to option valuevalue: a list of initially selected optionslabel: text label for the elementon_change: optional callback to run when this element’s value changesfull_width: whether the input should take up the full width of its containermax_selections: maximum number of items that can be selected
Public methods
from_series(series, **kwargs)Create a multiselect from a dataframe series.
Inherited from
UIElementform([label, bordered, loading, ...])Create a submittable form out of this
UIElement.send_message(message, buffers)Send a message to the element rendered on the frontend from the backend.
Inherited from
Htmlbatch(**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.
style(style)Wrap an object in a styled container.
Public Data Attributes:
Inherited from
UIElementvalueThe element’s current value.
Inherited from
HtmltextA string of HTML representing this element.
- static from_series(series: DataFrameSeries, **kwargs: Any) multiselect¶
Create a multiselect from a dataframe series.