888cb46 ←57b3f29antonApr 20, 2026 api

create widgets.py via macOS

A /docs/undefined +53 -0
A /docs/undefined +53 -0
1import marimo
2
3__generated_with = "0.13.0"
4app = marimo.App()
5
6
7@app.cell
8def intro():
9 import marimo as mo
10 mo.md("# Widget Demo")
11 return (mo,)
12
13
14@app.cell
15def slider_demo(mo):
16 threshold = mo.ui.slider(start=0, stop=100, value=50, label="threshold")
17 threshold
18 return (threshold,)
19
20
21@app.cell
22def dropdown_demo(mo):
23 city = mo.ui.dropdown(options=["Dublin", "Berlin", "Paris", "Amsterdam"], label="city")
24 city
25 return (city,)
26
27
28@app.cell
29def text_demo(mo):
30 name = mo.ui.text(placeholder="your name", label="name")
31 name
32 return (name,)
33
34
35@app.cell
36def checkbox_demo(mo):
37 verbose = mo.ui.checkbox(label="verbose output")
38 verbose
39 return (verbose,)
40
41
42@app.cell
43def use_widgets(threshold, city, name, verbose):
44 print(f"threshold: {threshold.value}")
45 print(f"city: {city.value}")
46 print(f"name: {name.value}")
47 if verbose.value:
48 print("verbose mode enabled")
49 return ()
50
51
52if __name__ == "__main__":
53 app.run()