Multiselect#

class marimo.ui.multiselect(options: Sequence[str] | dict[str, Any], value: Sequence[str] | None = None, *, label: str = '', full_width: bool = False, on_change: Callable[[List[object]], None] | None = None)#

A multiselect input.

Example.

multiselect = mo.ui.multiselect(
  options=['a', 'b', 'c'],
  label='choose some options'
)

Attributes.

  • value: the selected values, or None if no selection

  • options: a dict mapping option name to option value

  • full_width: whether the input should take up the full width of its container Initialization Args.

  • options: sequence of text options, or dict mapping option name to option value

  • value: a list of initially selected options

  • label: text label for the element

  • on_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:

Inherited from UIElement

value

The element’s current value.

Inherited from Html

text

A string of HTML representing this element.