-
Notifications
You must be signed in to change notification settings - Fork 348
/
Copy pathtabs_advanced.py
77 lines (60 loc) · 1.47 KB
/
tabs_advanced.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "marimo",
# ]
# ///
import marimo
__generated_with = "0.10.6"
app = marimo.App()
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell(hide_code=True)
def _(mo):
mo.md("""# Tabs""")
return
@app.cell(hide_code=True)
def _(mo):
mo.md("""Use `mo.ui.tabs` to organize outputs.""")
return
@app.cell
def _(mo):
settings = mo.vstack(
[
mo.md("Edit User"),
first := mo.ui.text(label="First Name"),
last := mo.ui.text(label="Last Name"),
]
)
organization = mo.vstack(
[
mo.md("Edit Organization"),
org := mo.ui.text(label="Organization Name", value="..."),
employees := mo.ui.number(
label="Number of Employees", start=0, stop=1000
),
]
)
mo.ui.tabs(
{
"🧙♀ User": settings,
"🏢 Organization": organization,
}
)
return employees, first, last, org, organization, settings
@app.cell
def _(employees, first, last, mo, org):
mo.md(
f"""
Welcome **{first.value} {last.value}** to **{org.value}**! You are
employee no. **{employees.value + 1}**.
#{"🎉" * (min(employees.value + 1, 1000))}
"""
) if all([first.value, last.value, org.value]) else mo.md(
"Type a first and last name!"
)
return
if __name__ == "__main__":
app.run()