Skip to main content

mo.ui.multiselect

Create a multiselect dropdown for selecting multiple options.

Signature

mo.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
)

Parameters

options
Sequence[str] | dict[str, Any]
required
List of options or dictionary mapping labels to values
value
Sequence[str]
Initially selected values
label
str
default:"''"
Markdown label for the multiselect
full_width
bool
default:"False"
Whether multiselect takes full width
max_selections
int
Maximum number of selections allowed

Examples

import marimo as mo

# Basic multiselect
fruits = mo.ui.multiselect(
    options=["Apple", "Banana", "Cherry", "Date"],
    label="**Select fruits:**"
)
fruits
# With initial selection
selected = mo.ui.multiselect(
    options=["Python", "JavaScript", "Rust", "Go"],
    value=["Python"],
    label="Programming languages"
)

mo.md(f"You selected: {', '.join(selected.value)}")
# Limited selections
top_three = mo.ui.multiselect(
    options=["A", "B", "C", "D", "E"],
    max_selections=3,
    label="Pick your top 3"
)

Build docs developers (and LLMs) love