Contents Menu Expand Light mode Dark mode Auto light/dark mode
marimo
Light Logo Dark Logo
  • Getting Started
  • Guides
    • Overview
    • Reactivity
    • Interactivity
    • Outputs
    • Apps
    • Scripts
    • Best Practices
  • API Reference
    • Markdown
    • Inputs
      • Array
      • Batch
      • Button
      • Checkbox
      • Date
      • Dictionary
      • Dropdown
      • File
      • Form
      • Multiselect
      • Number
      • Radio
      • Refresh
      • Slider
      • Switch
      • Table
      • Text
      • Text Area
    • Layouts
      • Accordion
      • Callout
      • Image
      • Stacks
      • Tabs
      • Tree
    • HTML
    • Misc
  • Examples
  • FAQ
Back to top
Edit this page

Dropdown#

class marimo.ui.dropdown(options: Sequence[str] | dict[str, Any], value: str | None = None, allow_select_none: bool | None = None, *, label: str = '')#

A dropdown menu.

Example.

dropdown = mo.ui.dropdown(
  options=['a', 'b', 'c'],
  value='a',
  label='choose one'
)
dropdown = mo.ui.dropdown(
  options={'one': 1, 'two': 2, 'three': 3],
  value='one',
  label='pick a number'
)

Attributes.

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

  • options: a dict mapping option name to option value

Initialization Args.

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

  • value: default option name

  • allow_select_none: whether to include special option ("--") for a None value; when None, defaults to True when value is None

  • label: text label for the element

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.


Next
File
Previous
Dictionary
Copyright © 2023, marimo-team
Made with Sphinx and @pradyunsg's Furo
On this page
  • Dropdown
    • dropdown