Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

655 B
Raw Blame

Dropdown

/// marimo-embed

@app.cell
def __():
    dropdown = mo.ui.dropdown(options=["Apples", "Oranges", "Pears"], label="choose fruit")
    dropdown_dict = mo.ui.dropdown(options={"Apples":1, "Oranges":2, "Pears":3},
                            value="Apples", # initial value
                            label="choose fruit with dict options")
    return

@app.cell
def __():
    mo.vstack([mo.hstack([dropdown, mo.md(f"Has value: {dropdown.value}")]),
    mo.hstack([dropdown_dict, mo.md(f"Has value: {dropdown_dict.value} and selected_key {dropdown_dict.selected_key}")]),
                ])
    return

///

::: marimo.ui.dropdown