diff --git a/generated/examples/ui/arrays_and_dicts.py.ipynb b/generated/examples/ui/arrays_and_dicts.py.ipynb
index 997ba12..7bc2d16 100644
--- a/generated/examples/ui/arrays_and_dicts.py.ipynb
+++ b/generated/examples/ui/arrays_and_dicts.py.ipynb
@@ -1,8 +1,19 @@
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "code",
+ "execution_count": null,
"id": "Hbol",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import marimo as mo\n",
+ "import random"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "MJUe",
"metadata": {
"marimo": {
"config": {
@@ -16,7 +27,7 @@
},
{
"cell_type": "markdown",
- "id": "MJUe",
+ "id": "vblA",
"metadata": {
"marimo": {
"config": {
@@ -36,7 +47,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "vblA",
+ "id": "bkHC",
"metadata": {},
"outputs": [],
"source": [
@@ -46,13 +57,13 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "bkHC",
+ "id": "lEQa",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
- "
"
+ ""
]
},
"metadata": {},
@@ -65,7 +76,7 @@
},
{
"cell_type": "markdown",
- "id": "lEQa",
+ "id": "PKri",
"metadata": {},
"source": [
"UI Elements ..."
@@ -74,13 +85,13 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "PKri",
+ "id": "Xref",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
- ""
+ ""
]
},
"metadata": {},
@@ -103,7 +114,7 @@
},
{
"cell_type": "markdown",
- "id": "Xref",
+ "id": "SFPL",
"metadata": {},
"source": [
"... and their values"
@@ -112,7 +123,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "SFPL",
+ "id": "BYtC",
"metadata": {},
"outputs": [
{
@@ -131,7 +142,7 @@
},
{
"cell_type": "markdown",
- "id": "BYtC",
+ "id": "RGSE",
"metadata": {
"marimo": {
"config": {
@@ -148,7 +159,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "RGSE",
+ "id": "Kclp",
"metadata": {
"marimo": {
"config": {
@@ -160,7 +171,7 @@
{
"data": {
"text/html": [
- ""
+ ""
]
},
"metadata": {},
@@ -201,7 +212,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "Kclp",
+ "id": "emfo",
"metadata": {
"marimo": {
"config": {
@@ -213,7 +224,7 @@
{
"data": {
"text/html": [
- ""
+ ""
]
},
"metadata": {},
@@ -234,7 +245,7 @@
},
{
"cell_type": "markdown",
- "id": "emfo",
+ "id": "Hstk",
"metadata": {
"marimo": {
"config": {
@@ -245,17 +256,6 @@
"source": [
"Notice that when you interact with the UI elements in the marimo dict, the reference of marimo dict updates automatically. However, when you interact with the elements in the python dict, you need to manually re-run the cell to see the updated values."
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "Hstk",
- "metadata": {},
- "outputs": [],
- "source": [
- "import marimo as mo\n",
- "import random"
- ]
}
],
"metadata": {},
diff --git a/generated/examples/ui/arrays_and_dicts.py.md b/generated/examples/ui/arrays_and_dicts.py.md
index f1c9c8f..92e5a6a 100644
--- a/generated/examples/ui/arrays_and_dicts.py.md
+++ b/generated/examples/ui/arrays_and_dicts.py.md
@@ -1,8 +1,13 @@
---
title: Arrays And Dicts
-marimo-version: 0.9.34
+marimo-version: 0.11.0
---
+```python {.marimo}
+import marimo as mo
+import random
+```
+
# Arrays and Dictionaries
Use `mo.ui.array` and `mo.ui.dictionary` to create UI elements that wrap
@@ -12,17 +17,17 @@ Because UI elements must be assigned to global variables,
these functions are required when the set of elements to create is not
known until runtime.
-```{.python.marimo}
+```python {.marimo}
create = mo.ui.button(label="Create new collections")
```
-```{.python.marimo}
+```python {.marimo}
create.center()
```
UI Elements ...
-```{.python.marimo}
+```python {.marimo}
create
array = mo.ui.array(
@@ -38,7 +43,7 @@ mo.hstack([array, dictionary], justify="space-around")
... and their values
-```{.python.marimo}
+```python {.marimo}
mo.hstack([array.value, dictionary.value], justify="space-around")
```
@@ -46,7 +51,7 @@ Key difference between marimo dict and standard python dict:
The main reason to use `mo.ui.dictionary` is for reactive execution — when you interact with an element in a `mo.ui.dictionary`, all cells that reference the `mo.ui.dictionary` run automatically, just like all other ui elements. When you use a regular dictionary, you don't get this reactivity.
-```{.python.marimo hide_code="true"}
+```python {.marimo hide_code="true"}
create
slider = mo.ui.slider(1, 10, show_value=True)
@@ -77,7 +82,7 @@ mo.hstack(
)
```
-```{.python.marimo hide_code="true"}
+```python {.marimo hide_code="true"}
mo_d_ref = {k: mo_d[k].value for k in mo_d.value.keys()}
py_d_ref = {k: py_d[k].value for k in py_d.keys()}
mo.hstack(
@@ -89,9 +94,4 @@ mo.hstack(
)
```
-Notice that when you interact with the UI elements in the marimo dict, the reference of marimo dict updates automatically. However, when you interact with the elements in the python dict, you need to manually re-run the cell to see the updated values.
-
-```{.python.marimo}
-import marimo as mo
-import random
-```
\ No newline at end of file
+Notice that when you interact with the UI elements in the marimo dict, the reference of marimo dict updates automatically. However, when you interact with the elements in the python dict, you need to manually re-run the cell to see the updated values.
\ No newline at end of file
diff --git a/generated/examples/ui/arrays_and_dicts.script.py b/generated/examples/ui/arrays_and_dicts.script.py
index f0e2d9a..b74bc00 100644
--- a/generated/examples/ui/arrays_and_dicts.script.py
+++ b/generated/examples/ui/arrays_and_dicts.script.py
@@ -1,5 +1,5 @@
-__generated_with = "0.9.34"
+__generated_with = "0.11.0"
# %%
import marimo as mo
diff --git a/generated/examples/ui/batch_and_form.py.ipynb b/generated/examples/ui/batch_and_form.py.ipynb
index d5da7f1..46b222c 100644
--- a/generated/examples/ui/batch_and_form.py.ipynb
+++ b/generated/examples/ui/batch_and_form.py.ipynb
@@ -1,17 +1,27 @@
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "code",
+ "execution_count": null,
"id": "Hbol",
"metadata": {},
+ "outputs": [],
"source": [
- "# Batch and Form"
+ "import marimo as mo"
]
},
{
"cell_type": "markdown",
"id": "MJUe",
"metadata": {},
+ "source": [
+ "# Batch and Form"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "vblA",
+ "metadata": {},
"source": [
"Make custom UI elements using `batch()`, and turn any UI element\n",
"into a form with `form()`."
@@ -20,15 +30,15 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "vblA",
+ "id": "bkHC",
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
- "<marimo-form data-initial-value='null' data-label='null' data-element-id='"vblA-7"' data-loading='false' data-bordered='false' data-submit-button-label='"Submit"' data-submit-button-disabled='false' data-clear-on-submit='false' data-show-clear-button='true' data-clear-button-label='"Clear"' data-should-validate='false'><marimo-ui-element object-id='vblA-7' random-id='47378190-96da-1dac-72ff-5d2a386ecbe0'><marimo-dict data-initial-value='{"x": 1, "y": 1}' data-label='null' data-element-ids='{"vblA-5": "x", "vblA-6": "y"}'><span class="markdown prose dark:prose-invert"><span class="paragraph">Choose your variable values</span>\n",
- "<span class="paragraph"><marimo-ui-element object-id='vblA-5' random-id='b74d0fb1-32e7-0629-8fad-c1a606cb0fb3'><marimo-slider data-initial-value='1' data-label='"<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\"><marimo-tex class=\"arithmatex\">||(x =||)</marimo-tex></span></span>"' data-start='1' data-stop='10' data-step='1' data-steps='[]' data-debounce='false' data-orientation='"horizontal"' data-show-value='false' data-full-width='false'></marimo-slider></marimo-ui-element></span>\n",
- "<span class="paragraph"><marimo-ui-element object-id='vblA-6' random-id='6b65a6a4-8b81-48f6-b38a-088ca65ed389'><marimo-slider data-initial-value='1' data-label='"<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\"><marimo-tex class=\"arithmatex\">||(y =||)</marimo-tex></span></span>"' data-start='1' data-stop='10' data-step='1' data-steps='[]' data-debounce='false' data-orientation='"horizontal"' data-show-value='false' data-full-width='false'></marimo-slider></marimo-ui-element></span></span></marimo-dict></marimo-ui-element></marimo-form>"
+ "<marimo-form data-initial-value='null' data-label='null' data-element-id='"bkHC-7"' data-loading='false' data-bordered='false' data-submit-button-label='"Submit"' data-submit-button-disabled='false' data-clear-on-submit='false' data-show-clear-button='true' data-clear-button-label='"Clear"' data-should-validate='false'><marimo-ui-element object-id='bkHC-7' random-id='47378190-96da-1dac-72ff-5d2a386ecbe0'><marimo-dict data-initial-value='{"x": 1, "y": 1}' data-label='null' data-element-ids='{"bkHC-5": "x", "bkHC-6": "y"}'><span class="markdown prose dark:prose-invert"><span class="paragraph">Choose your variable values</span>\n",
+ "<span class="paragraph"><marimo-ui-element object-id='bkHC-5' random-id='b74d0fb1-32e7-0629-8fad-c1a606cb0fb3'><marimo-slider data-initial-value='1' data-label='"<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\"><marimo-tex class=\"arithmatex\">||(x =||)</marimo-tex></span></span>"' data-start='1' data-stop='10' data-step='1' data-steps='[]' data-debounce='false' data-orientation='"horizontal"' data-show-value='false' data-full-width='false'></marimo-slider></marimo-ui-element></span>\n",
+ "<span class="paragraph"><marimo-ui-element object-id='bkHC-6' random-id='6b65a6a4-8b81-48f6-b38a-088ca65ed389'><marimo-slider data-initial-value='1' data-label='"<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\"><marimo-tex class=\"arithmatex\">||(y =||)</marimo-tex></span></span>"' data-start='1' data-stop='10' data-step='1' data-steps='[]' data-debounce='false' data-orientation='"horizontal"' data-show-value='false' data-full-width='false'></marimo-slider></marimo-ui-element></span></span></marimo-dict></marimo-ui-element></marimo-form>"
]
},
"metadata": {},
@@ -61,13 +71,13 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "bkHC",
+ "id": "lEQa",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
- ""
+ ""
]
},
"metadata": {},
@@ -98,7 +108,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "lEQa",
+ "id": "PKri",
"metadata": {},
"outputs": [],
"source": [
@@ -107,16 +117,6 @@
"submitted_values = {\"x\": set(), \"y\": set()}"
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "PKri",
- "metadata": {},
- "outputs": [],
- "source": [
- "reset = mo.ui.button(label=\"reset history\")"
- ]
- },
{
"cell_type": "code",
"execution_count": null,
@@ -124,7 +124,7 @@
"metadata": {},
"outputs": [],
"source": [
- "import marimo as mo"
+ "reset = mo.ui.button(label=\"reset history\")"
]
}
],
diff --git a/generated/examples/ui/batch_and_form.py.md b/generated/examples/ui/batch_and_form.py.md
index 333f90c..94c9465 100644
--- a/generated/examples/ui/batch_and_form.py.md
+++ b/generated/examples/ui/batch_and_form.py.md
@@ -1,14 +1,18 @@
---
title: Batch And Form
-marimo-version: 0.9.34
+marimo-version: 0.11.0
---
+```python {.marimo}
+import marimo as mo
+```
+
# Batch and Form
Make custom UI elements using `batch()`, and turn any UI element
into a form with `form()`.
-```{.python.marimo}
+```python {.marimo}
reset
variables = (
@@ -31,7 +35,7 @@ variables = (
variables
```
-```{.python.marimo}
+```python {.marimo}
if variables.value is not None:
submitted_values["x"].add(variables.value["x"])
submitted_values["y"].add(variables.value["y"])
@@ -52,16 +56,12 @@ mo.md(
).callout()
```
-```{.python.marimo}
+```python {.marimo}
reset
submitted_values = {"x": set(), "y": set()}
```
-```{.python.marimo}
+```python {.marimo}
reset = mo.ui.button(label="reset history")
-```
-
-```{.python.marimo}
-import marimo as mo
```
\ No newline at end of file
diff --git a/generated/examples/ui/batch_and_form.script.py b/generated/examples/ui/batch_and_form.script.py
index d54dde3..487d6d8 100644
--- a/generated/examples/ui/batch_and_form.script.py
+++ b/generated/examples/ui/batch_and_form.script.py
@@ -1,5 +1,5 @@
-__generated_with = "0.9.34"
+__generated_with = "0.11.0"
# %%
import marimo as mo
diff --git a/generated/examples/ui/data_explorer.py.ipynb b/generated/examples/ui/data_explorer.py.ipynb
index 1075fb2..ae5c914 100644
--- a/generated/examples/ui/data_explorer.py.ipynb
+++ b/generated/examples/ui/data_explorer.py.ipynb
@@ -1,73 +1,35 @@
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "code",
+ "execution_count": null,
"id": "Hbol",
- "metadata": {
- "marimo": {
- "config": {
- "hide_code": true
- }
- }
- },
+ "metadata": {},
+ "outputs": [],
"source": [
- "# Data Explorer"
+ "import marimo as mo"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "MJUe",
- "metadata": {
- "marimo": {
- "config": {
- "hide_code": true
- }
- }
- },
- "outputs": [
- {
- "data": {
- "text/markdown": [
- "This notebook lets you upload a CSV and plot its columns.\n",
- "\n",
- "You can download a sample CSV if you'd like."
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "metadata": {},
+ "outputs": [],
"source": [
- "sample = \"https://github.com/vega/vega/blob/main/docs/data/stocks.csv\"\n",
- "\n",
- "mo.md(\n",
- " f\"\"\"\n",
- " This notebook lets you upload a CSV and plot its columns.\n",
- "\n",
- " You can download a sample CSV if you'd like.\n",
- " \"\"\"\n",
- ")"
+ "from vega_datasets import data"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "vblA",
- "metadata": {
- "marimo": {
- "config": {
- "hide_code": true
- }
- }
- },
+ "metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
- "\n",
- "\n",
- ""
+ "<marimo-data-explorer data-initial-value='{}' data-label='null' data-data='"data:text/csv;base64,c2VwYWxMZW5ndGgsc2VwYWxXaWR0aCxwZXRhbExlbmd0aCxwZXRhbFdpZHRoLHNwZWNpZXMKNS4xLDMuNSwxLjQsMC4yLHNldG9zYQo0LjksMy4wLDEuNCwwLjIsc2V0b3NhCjQuNywzLjIsMS4zLDAuMixzZXRvc2EKNC42LDMuMSwxLjUsMC4yLHNldG9zYQo1LjAsMy42LDEuNCwwLjIsc2V0b3NhCjUuNCwzLjksMS43MDAwMDAwMDAwMDAwMDAyLDAuNCxzZXRvc2EKNC42LDMuNCwxLjQsMC4zMDAwMDAwMDAwMDAwMDAwNCxzZXRvc2EKNS4wLDMuNCwxLjUsMC4yLHNldG9zYQo0LjQsMi45LDEuNCwwLjIsc2V0b3NhCjQuOSwzLjEsMS41LDAuMSxzZXRvc2EKNS40LDMuNywxLjUsMC4yLHNldG9zYQo0LjgsMy40LDEuNiwwLjIsc2V0b3NhCjQuOCwzLjAsMS40LDAuMSxzZXRvc2EKNC4zLDMuMCwxLjEsMC4xLHNldG9zYQo1LjgsNC4wLDEuMiwwLjIsc2V0b3NhCjUuNyw0LjQsMS41LDAuNCxzZXRvc2EKNS40LDMuOSwxLjMsMC40LHNldG9zYQo1LjEsMy41LDEuNCwwLjMwMDAwMDAwMDAwMDAwMDA0LHNldG9zYQo1LjcsMy44LDEuNzAwMDAwMDAwMDAwMDAwMiwwLjMwMDAwMDAwMDAwMDAwMDA0LHNldG9zYQo1LjEsMy44LDEuNSwwLjMwMDAwMDAwMDAwMDAwMDA0LHNldG9zYQo1LjQsMy40LDEuNzAwMDAwMDAwMDAwMDAwMiwwLjIsc2V0b3NhCjUuMSwzLjcsMS41LDAuNCxzZXRvc2EKNC42LDMuNiwxLjAsMC4yLHNldG9zYQo1LjEsMy4zLDEuNzAwMDAwMDAwMDAwMDAwMiwwLjUsc2V0b3NhCjQuOCwzLjQsMS45LDAuMixzZXRvc2EKNS4wLDMuMCwxLjYsMC4yLHNldG9zYQo1LjAsMy40LDEuNiwwLjQsc2V0b3NhCjUuMiwzLjUsMS41LDAuMixzZXRvc2EKNS4yLDMuNCwxLjQsMC4yLHNldG9zYQo0LjcsMy4yLDEuNiwwLjIsc2V0b3NhCjQuOCwzLjEsMS42LDAuMixzZXRvc2EKNS40LDMuNCwxLjUsMC40LHNldG9zYQo1LjIsNC4xLDEuNSwwLjEsc2V0b3NhCjUuNSw0LjIsMS40LDAuMixzZXRvc2EKNC45LDMuMSwxLjUsMC4yLHNldG9zYQo1LjAsMy4yLDEuMiwwLjIsc2V0b3NhCjUuNSwzLjUsMS4zLDAuMixzZXRvc2EKNC45LDMuNiwxLjQsMC4xLHNldG9zYQo0LjQsMy4wLDEuMywwLjIsc2V0b3NhCjUuMSwzLjQsMS41LDAuMixzZXRvc2EKNS4wLDMuNSwxLjMsMC4zMDAwMDAwMDAwMDAwMDAwNCxzZXRvc2EKNC41LDIuMywxLjMsMC4zMDAwMDAwMDAwMDAwMDAwNCxzZXRvc2EKNC40LDMuMiwxLjMsMC4yLHNldG9zYQo1LjAsMy41LDEuNiwwLjYwMDAwMDAwMDAwMDAwMDEsc2V0b3NhCjUuMSwzLjgsMS45LDAuNCxzZXRvc2EKNC44LDMuMCwxLjQsMC4zMDAwMDAwMDAwMDAwMDAwNCxzZXRvc2EKNS4xLDMuOCwxLjYsMC4yLHNldG9zYQo0LjYsMy4yLDEuNCwwLjIsc2V0b3NhCjUuMywzLjcsMS41LDAuMixzZXRvc2EKNS4wLDMuMywxLjQsMC4yLHNldG9zYQo3LjAsMy4yLDQuNywxLjQsdmVyc2ljb2xvcgo2LjQsMy4yLDQuNSwxLjUsdmVyc2ljb2xvcgo2LjksMy4xLDQuOSwxLjUsdmVyc2ljb2xvcgo1LjUsMi4zLDQuMCwxLjMsdmVyc2ljb2xvcgo2LjUsMi44LDQuNiwxLjUsdmVyc2ljb2xvcgo1LjcsMi44LDQuNSwxLjMsdmVyc2ljb2xvcgo2LjMsMy4zLDQuNywxLjYsdmVyc2ljb2xvcgo0LjksMi40LDMuMywxLjAsdmVyc2ljb2xvcgo2LjYsMi45LDQuNiwxLjMsdmVyc2ljb2xvcgo1LjIsMi43LDMuOSwxLjQsdmVyc2ljb2xvcgo1LjAsMi4wLDMuNSwxLjAsdmVyc2ljb2xvcgo1LjksMy4wLDQuMiwxLjUsdmVyc2ljb2xvcgo2LjAsMi4yLDQuMCwxLjAsdmVyc2ljb2xvcgo2LjEsMi45LDQuNywxLjQsdmVyc2ljb2xvcgo1LjYsMi45LDMuNiwxLjMsdmVyc2ljb2xvcgo2LjcsMy4xLDQuNCwxLjQsdmVyc2ljb2xvcgo1LjYsMy4wLDQuNSwxLjUsdmVyc2ljb2xvcgo1LjgsMi43LDQuMSwxLjAsdmVyc2ljb2xvcgo2LjIsMi4yLDQuNSwxLjUsdmVyc2ljb2xvcgo1LjYsMi41LDMuOSwxLjEsdmVyc2ljb2xvcgo1LjksMy4yLDQuOCwxLjgsdmVyc2ljb2xvcgo2LjEsMi44LDQuMCwxLjMsdmVyc2ljb2xvcgo2LjMsMi41LDQuOSwxLjUsdmVyc2ljb2xvcgo2LjEsMi44LDQuNywxLjIsdmVyc2ljb2xvcgo2LjQsMi45LDQuMywxLjMsdmVyc2ljb2xvcgo2LjYsMy4wLDQuNCwxLjQsdmVyc2ljb2xvcgo2LjgsMi44LDQuOCwxLjQsdmVyc2ljb2xvcgo2LjcsMy4wLDUuMCwxLjcwMDAwMDAwMDAwMDAwMDIsdmVyc2ljb2xvcgo2LjAsMi45LDQuNSwxLjUsdmVyc2ljb2xvcgo1LjcsMi42LDMuNSwxLjAsdmVyc2ljb2xvcgo1LjUsMi40LDMuOCwxLjEsdmVyc2ljb2xvcgo1LjUsMi40LDMuNywxLjAsdmVyc2ljb2xvcgo1LjgsMi43LDMuOSwxLjIsdmVyc2ljb2xvcgo2LjAsMi43LDUuMSwxLjYsdmVyc2ljb2xvcgo1LjQsMy4wLDQuNSwxLjUsdmVyc2ljb2xvcgo2LjAsMy40LDQuNSwxLjYsdmVyc2ljb2xvcgo2LjcsMy4xLDQuNywxLjUsdmVyc2ljb2xvcgo2LjMsMi4zLDQuNCwxLjMsdmVyc2ljb2xvcgo1LjYsMy4wLDQuMSwxLjMsdmVyc2ljb2xvcgo1LjUsMi41LDQuMCwxLjMsdmVyc2ljb2xvcgo1LjUsMi42LDQuNCwxLjIsdmVyc2ljb2xvcgo2LjEsMy4wLDQuNiwxLjQsdmVyc2ljb2xvcgo1LjgsMi42LDQuMCwxLjIsdmVyc2ljb2xvcgo1LjAsMi4zLDMuMywxLjAsdmVyc2ljb2xvcgo1LjYsMi43LDQuMiwxLjMsdmVyc2ljb2xvcgo1LjcsMy4wLDQuMiwxLjIsdmVyc2ljb2xvcgo1LjcsMi45LDQuMiwxLjMsdmVyc2ljb2xvcgo2LjIsMi45LDQuMywxLjMsdmVyc2ljb2xvcgo1LjEsMi41LDMuMCwxLjEsdmVyc2ljb2xvcgo1LjcsMi44LDQuMSwxLjMsdmVyc2ljb2xvcgo2LjMsMy4zLDYuMCwyLjUsdmlyZ2luaWNhCjUuOCwyLjcsNS4xLDEuOSx2aXJnaW5pY2EKNy4xLDMuMCw1LjksMi4xLHZpcmdpbmljYQo2LjMsMi45LDUuNiwxLjgsdmlyZ2luaWNhCjYuNSwzLjAsNS44LDIuMix2aXJnaW5pY2EKNy42LDMuMCw2LjYsMi4xLHZpcmdpbmljYQo0LjksMi41LDQuNSwxLjcwMDAwMDAwMDAwMDAwMDIsdmlyZ2luaWNhCjcuMywyLjksNi4zLDEuOCx2aXJnaW5pY2EKNi43LDIuNSw1LjgsMS44LHZpcmdpbmljYQo3LjIsMy42LDYuMSwyLjUsdmlyZ2luaWNhCjYuNSwzLjIsNS4xLDIuMCx2aXJnaW5pY2EKNi40LDIuNyw1LjMsMS45LHZpcmdpbmljYQo2LjgsMy4wLDUuNSwyLjEsdmlyZ2luaWNhCjUuNywyLjUsNS4wLDIuMCx2aXJnaW5pY2EKNS44LDIuOCw1LjEsMi40LHZpcmdpbmljYQo2LjQsMy4yLDUuMywyLjMsdmlyZ2luaWNhCjYuNSwzLjAsNS41LDEuOCx2aXJnaW5pY2EKNy43LDMuOCw2LjcsMi4yLHZpcmdpbmljYQo3LjcsMi42LDYuOSwyLjMsdmlyZ2luaWNhCjYuMCwyLjIsNS4wLDEuNSx2aXJnaW5pY2EKNi45LDMuMiw1LjcsMi4zLHZpcmdpbmljYQo1LjYsMi44LDQuOSwyLjAsdmlyZ2luaWNhCjcuNywyLjgsNi43LDIuMCx2aXJnaW5pY2EKNi4zLDIuNyw0LjksMS44LHZpcmdpbmljYQo2LjcsMy4zLDUuNywyLjEsdmlyZ2luaWNhCjcuMiwzLjIsNi4wLDEuOCx2aXJnaW5pY2EKNi4yLDIuOCw0LjgsMS44LHZpcmdpbmljYQo2LjEsMy4wLDQuOSwxLjgsdmlyZ2luaWNhCjYuNCwyLjgsNS42LDIuMSx2aXJnaW5pY2EKNy4yLDMuMCw1LjgsMS42LHZpcmdpbmljYQo3LjQsMi44LDYuMSwxLjksdmlyZ2luaWNhCjcuOSwzLjgsNi40LDIuMCx2aXJnaW5pY2EKNi40LDIuOCw1LjYsMi4yLHZpcmdpbmljYQo2LjMsMi44LDUuMSwxLjUsdmlyZ2luaWNhCjYuMSwyLjYsNS42LDEuNCx2aXJnaW5pY2EKNy43LDMuMCw2LjEsMi4zLHZpcmdpbmljYQo2LjMsMy40LDUuNiwyLjQsdmlyZ2luaWNhCjYuNCwzLjEsNS41LDEuOCx2aXJnaW5pY2EKNi4wLDMuMCw0LjgsMS44LHZpcmdpbmljYQo2LjksMy4xLDUuNCwyLjEsdmlyZ2luaWNhCjYuNywzLjEsNS42LDIuNCx2aXJnaW5pY2EKNi45LDMuMSw1LjEsMi4zLHZpcmdpbmljYQo1LjgsMi43LDUuMSwxLjksdmlyZ2luaWNhCjYuOCwzLjIsNS45LDIuMyx2aXJnaW5pY2EKNi43LDMuMyw1LjcsMi41LHZpcmdpbmljYQo2LjcsMy4wLDUuMiwyLjMsdmlyZ2luaWNhCjYuMywyLjUsNS4wLDEuOSx2aXJnaW5pY2EKNi41LDMuMCw1LjIsMi4wLHZpcmdpbmljYQo2LjIsMy40LDUuNCwyLjMsdmlyZ2luaWNhCjUuOSwzLjAsNS4xLDEuOCx2aXJnaW5pY2EK"'></marimo-data-explorer>"
]
},
"metadata": {},
@@ -75,13 +37,8 @@
}
],
"source": [
- "mo.md(\n",
- " f\"\"\"\n",
- " {mo.hstack([mo.md(\"**Upload a CSV.**\")], justify=\"center\")}\n",
- "\n",
- " {uploaded_file}\n",
- " \"\"\"\n",
- ")"
+ "explorer = mo.ui.data_explorer(data.iris())\n",
+ "explorer"
]
},
{
@@ -89,100 +46,17 @@
"execution_count": null,
"id": "bkHC",
"metadata": {},
- "outputs": [],
- "source": [
- "mo.stop(not uploaded_file.name())\n",
- "df = pd.read_csv(io.StringIO(uploaded_file.contents().decode()))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "lEQa",
- "metadata": {},
- "outputs": [],
- "source": [
- "mo.ui.table(df, page_size=5, selection=None)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "PKri",
- "metadata": {},
- "outputs": [],
- "source": [
- "plot_type = mo.ui.dropdown(\n",
- " [\"line\", \"hist\"], value=\"line\", label=\"Choose a plot type: \"\n",
- ")\n",
- "\n",
- "x_column = mo.ui.dropdown(df.columns, label=\"Choose x-axis: \")\n",
- "y_column = mo.ui.dropdown(df.columns, label=\"Choose y-axis: \")\n",
- "color_column = mo.ui.dropdown(df.columns, label=\"Choose color-axis: \")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "Xref",
- "metadata": {},
- "outputs": [],
- "source": [
- "mo.hstack(\n",
- " [x_column, y_column, color_column, plot_type], justify=\"space-around\"\n",
- ").callout(kind=\"warn\" if not x_column.value else \"neutral\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "SFPL",
- "metadata": {},
- "outputs": [],
- "source": [
- "mo.stop(not x_column.value)\n",
- "\n",
- "\n",
- "def plot(x_column, y_column, color_column):\n",
- " y_column = y_column or \"count()\"\n",
- " title = f\"{y_column} by {x_column}\"\n",
- " encoding = {\"x\": x_column, \"y\": y_column}\n",
- " if color_column:\n",
- " encoding[\"color\"] = color_column\n",
- " if plot_type.value == \"line\":\n",
- " chart = alt.Chart(df).mark_line()\n",
- " else:\n",
- " chart = alt.Chart(df).mark_bar().encode(x=alt.X(x_column, bin=True))\n",
- " return chart.encode(**encoding).properties(title=title, width=\"container\")\n",
- "\n",
- "\n",
- "plot(x_column.value, y_column.value, color_column.value)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "BYtC",
- "metadata": {},
- "outputs": [],
- "source": [
- "uploaded_file = mo.ui.file(filetypes=[\".csv\"], kind=\"area\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "RGSE",
- "metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "application/json": "{}"
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
"source": [
- "import marimo as mo\n",
- "import altair as alt\n",
- "\n",
- "\n",
- "import io\n",
- "import matplotlib.pyplot as plt\n",
- "import pandas as pd"
+ "explorer.value"
]
}
],
diff --git a/generated/examples/ui/data_explorer.py.md b/generated/examples/ui/data_explorer.py.md
index fa5a8fb..2be8645 100644
--- a/generated/examples/ui/data_explorer.py.md
+++ b/generated/examples/ui/data_explorer.py.md
@@ -1,88 +1,22 @@
---
title: Data Explorer
-marimo-version: 0.9.34
-width: full
+marimo-version: 0.11.0
+width: medium
---
-# Data Explorer
-
-```{.python.marimo hide_code="true"}
-sample = "https://github.com/vega/vega/blob/main/docs/data/stocks.csv"
-
-mo.md(
- f"""
- This notebook lets you upload a CSV and plot its columns.
-
- You can download a sample CSV if you'd like.
- """
-)
-```
-
-```{.python.marimo hide_code="true"}
-mo.md(
- f"""
- {mo.hstack([mo.md("**Upload a CSV.**")], justify="center")}
-
- {uploaded_file}
- """
-)
-```
-
-```{.python.marimo}
-mo.stop(not uploaded_file.name())
-df = pd.read_csv(io.StringIO(uploaded_file.contents().decode()))
-```
-
-```{.python.marimo}
-mo.ui.table(df, page_size=5, selection=None)
-```
-
-```{.python.marimo}
-plot_type = mo.ui.dropdown(
- ["line", "hist"], value="line", label="Choose a plot type: "
-)
-
-x_column = mo.ui.dropdown(df.columns, label="Choose x-axis: ")
-y_column = mo.ui.dropdown(df.columns, label="Choose y-axis: ")
-color_column = mo.ui.dropdown(df.columns, label="Choose color-axis: ")
+```python {.marimo}
+import marimo as mo
```
-```{.python.marimo}
-mo.hstack(
- [x_column, y_column, color_column, plot_type], justify="space-around"
-).callout(kind="warn" if not x_column.value else "neutral")
+```python {.marimo}
+from vega_datasets import data
```
-```{.python.marimo}
-mo.stop(not x_column.value)
-
-
-def plot(x_column, y_column, color_column):
- y_column = y_column or "count()"
- title = f"{y_column} by {x_column}"
- encoding = {"x": x_column, "y": y_column}
- if color_column:
- encoding["color"] = color_column
- if plot_type.value == "line":
- chart = alt.Chart(df).mark_line()
- else:
- chart = alt.Chart(df).mark_bar().encode(x=alt.X(x_column, bin=True))
- return chart.encode(**encoding).properties(title=title, width="container")
-
-
-plot(x_column.value, y_column.value, color_column.value)
+```python {.marimo}
+explorer = mo.ui.data_explorer(data.iris())
+explorer
```
-```{.python.marimo}
-uploaded_file = mo.ui.file(filetypes=[".csv"], kind="area")
-```
-
-```{.python.marimo}
-import marimo as mo
-import altair as alt
-
-
-import io
-import matplotlib.pyplot as plt
-import pandas as pd
+```python {.marimo}
+explorer.value
```
\ No newline at end of file
diff --git a/generated/examples/ui/data_explorer.script.py b/generated/examples/ui/data_explorer.script.py
index 3fc1729..eae012b 100644
--- a/generated/examples/ui/data_explorer.script.py
+++ b/generated/examples/ui/data_explorer.script.py
@@ -1,77 +1,15 @@
-__generated_with = "0.9.34"
+__generated_with = "0.11.0"
# %%
import marimo as mo
-import altair as alt
-
-
-import io
-import matplotlib.pyplot as plt
-import pandas as pd
-
-# %%
-mo.md("""# Data Explorer""")
-
-# %%
-sample = "https://github.com/vega/vega/blob/main/docs/data/stocks.csv"
-
-mo.md(
- f"""
- This notebook lets you upload a CSV and plot its columns.
-
- You can download a sample CSV if you'd like.
- """
-)
-
-# %%
-uploaded_file = mo.ui.file(filetypes=[".csv"], kind="area")
-
-# %%
-mo.md(
- f"""
- {mo.hstack([mo.md("**Upload a CSV.**")], justify="center")}
-
- {uploaded_file}
- """
-)
-
-# %%
-mo.stop(not uploaded_file.name())
-df = pd.read_csv(io.StringIO(uploaded_file.contents().decode()))
# %%
-mo.ui.table(df, page_size=5, selection=None)
+from vega_datasets import data
# %%
-plot_type = mo.ui.dropdown(
- ["line", "hist"], value="line", label="Choose a plot type: "
-)
-
-x_column = mo.ui.dropdown(df.columns, label="Choose x-axis: ")
-y_column = mo.ui.dropdown(df.columns, label="Choose y-axis: ")
-color_column = mo.ui.dropdown(df.columns, label="Choose color-axis: ")
+explorer = mo.ui.data_explorer(data.iris())
+explorer
# %%
-mo.hstack(
- [x_column, y_column, color_column, plot_type], justify="space-around"
-).callout(kind="warn" if not x_column.value else "neutral")
-
-# %%
-mo.stop(not x_column.value)
-
-
-def plot(x_column, y_column, color_column):
- y_column = y_column or "count()"
- title = f"{y_column} by {x_column}"
- encoding = {"x": x_column, "y": y_column}
- if color_column:
- encoding["color"] = color_column
- if plot_type.value == "line":
- chart = alt.Chart(df).mark_line()
- else:
- chart = alt.Chart(df).mark_bar().encode(x=alt.X(x_column, bin=True))
- return chart.encode(**encoding).properties(title=title, width="container")
-
-
-plot(x_column.value, y_column.value, color_column.value)
\ No newline at end of file
+explorer.value
\ No newline at end of file
diff --git a/generated/examples/ui/layout.py.md b/generated/examples/ui/layout.py.md
index da80b79..d2e6033 100644
--- a/generated/examples/ui/layout.py.md
+++ b/generated/examples/ui/layout.py.md
@@ -1,13 +1,13 @@
---
title: Layout
-marimo-version: 0.9.34
+marimo-version: 0.11.0
---
# Stacks
Use `mo.hstack` and `mo.vstack` to layout outputs in rows and columns.
-```{.python.marimo}
+```python {.marimo}
align = mo.ui.dropdown(
label="Align", options=["start", "end", "center", "stretch"]
)
@@ -32,7 +32,7 @@ mo.md(
## Horizontal Stack: `hstack`
-```{.python.marimo}
+```python {.marimo}
mo.hstack(
boxes,
align=align.value,
@@ -44,7 +44,7 @@ mo.hstack(
## Vertical Stack: `vstack`
-```{.python.marimo}
+```python {.marimo}
mo.vstack(
boxes,
align=align.value,
@@ -52,7 +52,7 @@ mo.vstack(
)
```
-```{.python.marimo}
+```python {.marimo}
def create_box(num):
box_size = size.value + num * 10
return mo.Html(
@@ -63,6 +63,6 @@ def create_box(num):
boxes = [create_box(i) for i in range(1, 5)]
```
-```{.python.marimo}
+```python {.marimo}
import marimo as mo
```
\ No newline at end of file
diff --git a/generated/examples/ui/layout.script.py b/generated/examples/ui/layout.script.py
index d800ef4..1b3d39d 100644
--- a/generated/examples/ui/layout.script.py
+++ b/generated/examples/ui/layout.script.py
@@ -1,5 +1,5 @@
-__generated_with = "0.9.34"
+__generated_with = "0.11.0"
# %%
import marimo as mo
diff --git a/generated/examples/ui/refresh.py.ipynb b/generated/examples/ui/refresh.py.ipynb
index 96f3bb0..4e1c07a 100644
--- a/generated/examples/ui/refresh.py.ipynb
+++ b/generated/examples/ui/refresh.py.ipynb
@@ -7,20 +7,7 @@
"metadata": {},
"outputs": [],
"source": [
- "mo.hstack([\n",
- " mo.vstack([\n",
- " mo.md(\"## Settings | [`marimo.ui.slider`](https://docs.marimo.io/api/inputs/slider.html), [`marimo.ui.refresh`](https://docs.marimo.io/recipes.html#run-a-cell-on-a-timer)\\n---\"),\n",
- " refresh_interval_slider,\n",
- " n_points_slider,\n",
- " refresher,\n",
- " mo.md(\"## ISS Positions | [`marimo.ui.altair_chart`](https://docs.marimo.io/api/plotting.html#marimo.ui.altair_chart)\\n---\"),\n",
- " mo.as_html(chart).style({\"width\": \"700px\"})\n",
- " ], align=\"center\"),\n",
- " mo.vstack([\n",
- " mo.md(\"## Data | [`marimo.as_html`](https://docs.marimo.io/api/html.html)`(pd.DataFrame)`\\n---\"),\n",
- " mo.as_html(iss_df)\n",
- " ])\n",
- "], justify=\"center\", wrap=True, gap=3)"
+ "import marimo as mo"
]
},
{
@@ -28,27 +15,20 @@
"execution_count": null,
"id": "MJUe",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/markdown": [
+ "<marimo-refresh data-initial-value='0' data-label='null' data-options='[1]' data-default-interval='1'></marimo-refresh>"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
"source": [
- "hover=alt.selection_point(on=\"mouseover\", clear=\"mouseout\")\n",
- "\n",
- "# iss positions\n",
- "iss_df = get_iss_positions()\n",
- "iss = alt.Chart(iss_df[['longitude','latitude','timestamp']]).mark_circle(\n",
- " stroke='black', size=100,\n",
- ").encode(\n",
- " longitude=alt.Longitude('longitude:Q'),\n",
- " latitude='latitude:Q',\n",
- " fill=alt.Fill('timestamp:Q', scale=alt.Scale(scheme='purples'), legend=None),\n",
- " strokeWidth=alt.condition(hover, alt.value(3, empty=False), alt.value(0)),\n",
- " tooltip=[\n",
- " alt.Tooltip('longitude:Q', title='Longitude', format='.4f'),\n",
- " alt.Tooltip('latitude:Q', title='Latitude', format='.4f'),\n",
- " alt.Tooltip('timestamp:T', title='Timestamp', format='%Y-%m-%d %H:%M:%S')\n",
- " ]\n",
- ").add_params(hover)\n",
- "\n",
- "chart = alt.layer(sphere, world, iss).project(type=\"naturalEarth1\").properties(width=640, title=\"\")"
+ "refresh = mo.ui.refresh(default_interval=1)\n",
+ "refresh"
]
},
{
@@ -56,95 +36,17 @@
"execution_count": null,
"id": "vblA",
"metadata": {},
- "outputs": [],
- "source": [
- "# load geo data from Vega Datasets\n",
- "countries = alt.topo_feature(data.world_110m.url, 'countries')\n",
- "\n",
- "# world base\n",
- "sphere = alt.Chart(alt.sphere()).mark_geoshape(\n",
- " fill=\"aliceblue\", stroke=\"black\", strokeWidth=1.5\n",
- ")\n",
- "\n",
- "# world map\n",
- "world = alt.Chart(countries).mark_geoshape(\n",
- " fill=\"mintcream\", stroke=\"black\", strokeWidth=0.35\n",
- ")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "bkHC",
- "metadata": {},
- "outputs": [],
- "source": [
- "def get_iss_positions(refresher=refresher):\n",
- " refresher\n",
- " timepoints = [int(time())]\n",
- " while len(timepoints) <= n_points_slider.value:\n",
- " timepoints.append(timepoints[-1] - refresh_interval_slider.value)\n",
- " else:\n",
- " timepoints.pop(0)\n",
- " timepoints_str = str(timepoints)[1:-1].replace(\" \", \"\")\n",
- " iss_url = f\"https://api.wheretheiss.at/v1/satellites/25544/positions?timestamps={timepoints_str}\"\n",
- " response = requests.get(iss_url)\n",
- " df = pd.DataFrame(response.json())\n",
- " df['timestamp'] = pd.to_datetime(df.timestamp, unit='s')\n",
- " return df[['timestamp','latitude','longitude','altitude','velocity','visibility']]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "lEQa",
- "metadata": {},
- "outputs": [],
- "source": [
- "refresher = mo.ui.refresh(default_interval=f\"{refresh_interval_slider.value}s\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "PKri",
- "metadata": {},
- "outputs": [],
- "source": [
- "refresh_interval_slider = mo.ui.slider(start=5, stop=60, step=1, value=10, label=\"refresh interval (default = 10 sec)\")\n",
- "n_points_slider = mo.ui.slider(start=5, stop=30, step=1, value=15, label=\"number of points (default = 15)\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "Xref",
- "metadata": {},
"outputs": [
{
- "name": "stderr",
+ "name": "stdout",
"output_type": "stream",
"text": [
- "Traceback (most recent call last):\n",
- " File "/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/marimo/_runtime/executor.py", line 157, in execute_cell\n",
- " exec(cell.body, glbls)\n",
- " File "/tmp/marimo_2081/__marimo__cell_Xref_.py", line 4, in <module>\n",
- " import requests\n",
- "ModuleNotFoundError: No module named 'requests'\n",
- "
\n",
- ""
+ "0\n"
]
}
],
"source": [
- "import altair as alt\n",
- "import marimo as mo\n",
- "import pandas as pd\n",
- "import requests\n",
- "from time import time\n",
- "from vega_datasets import data\n",
- "\n",
- "pd.options.display.max_rows = 30"
+ "print(refresh.value)"
]
}
],
diff --git a/generated/examples/ui/refresh.py.md b/generated/examples/ui/refresh.py.md
index 07126cf..f4760bf 100644
--- a/generated/examples/ui/refresh.py.md
+++ b/generated/examples/ui/refresh.py.md
@@ -1,95 +1,17 @@
---
title: Refresh
-marimo-version: 0.9.34
-width: full
+marimo-version: 0.11.0
---
-```{.python.marimo}
-mo.hstack([
- mo.vstack([
- mo.md("## Settings | [`marimo.ui.slider`](https://docs.marimo.io/api/inputs/slider.html), [`marimo.ui.refresh`](https://docs.marimo.io/recipes.html#run-a-cell-on-a-timer)\n---"),
- refresh_interval_slider,
- n_points_slider,
- refresher,
- mo.md("## ISS Positions | [`marimo.ui.altair_chart`](https://docs.marimo.io/api/plotting.html#marimo.ui.altair_chart)\n---"),
- mo.as_html(chart).style({"width": "700px"})
- ], align="center"),
- mo.vstack([
- mo.md("## Data | [`marimo.as_html`](https://docs.marimo.io/api/html.html)`(pd.DataFrame)`\n---"),
- mo.as_html(iss_df)
- ])
-], justify="center", wrap=True, gap=3)
-```
-
-```{.python.marimo}
-hover=alt.selection_point(on="mouseover", clear="mouseout")
-
-# iss positions
-iss_df = get_iss_positions()
-iss = alt.Chart(iss_df[['longitude','latitude','timestamp']]).mark_circle(
- stroke='black', size=100,
-).encode(
- longitude=alt.Longitude('longitude:Q'),
- latitude='latitude:Q',
- fill=alt.Fill('timestamp:Q', scale=alt.Scale(scheme='purples'), legend=None),
- strokeWidth=alt.condition(hover, alt.value(3, empty=False), alt.value(0)),
- tooltip=[
- alt.Tooltip('longitude:Q', title='Longitude', format='.4f'),
- alt.Tooltip('latitude:Q', title='Latitude', format='.4f'),
- alt.Tooltip('timestamp:T', title='Timestamp', format='%Y-%m-%d %H:%M:%S')
- ]
-).add_params(hover)
-
-chart = alt.layer(sphere, world, iss).project(type="naturalEarth1").properties(width=640, title="")
-```
-
-```{.python.marimo}
-# load geo data from Vega Datasets
-countries = alt.topo_feature(data.world_110m.url, 'countries')
-
-# world base
-sphere = alt.Chart(alt.sphere()).mark_geoshape(
- fill="aliceblue", stroke="black", strokeWidth=1.5
-)
-
-# world map
-world = alt.Chart(countries).mark_geoshape(
- fill="mintcream", stroke="black", strokeWidth=0.35
-)
-```
-
-```{.python.marimo}
-def get_iss_positions(refresher=refresher):
- refresher
- timepoints = [int(time())]
- while len(timepoints) <= n_points_slider.value:
- timepoints.append(timepoints[-1] - refresh_interval_slider.value)
- else:
- timepoints.pop(0)
- timepoints_str = str(timepoints)[1:-1].replace(" ", "")
- iss_url = f"https://api.wheretheiss.at/v1/satellites/25544/positions?timestamps={timepoints_str}"
- response = requests.get(iss_url)
- df = pd.DataFrame(response.json())
- df['timestamp'] = pd.to_datetime(df.timestamp, unit='s')
- return df[['timestamp','latitude','longitude','altitude','velocity','visibility']]
-```
-
-```{.python.marimo}
-refresher = mo.ui.refresh(default_interval=f"{refresh_interval_slider.value}s")
+```python {.marimo}
+import marimo as mo
```
-```{.python.marimo}
-refresh_interval_slider = mo.ui.slider(start=5, stop=60, step=1, value=10, label="refresh interval (default = 10 sec)")
-n_points_slider = mo.ui.slider(start=5, stop=30, step=1, value=15, label="number of points (default = 15)")
+```python {.marimo}
+refresh = mo.ui.refresh(default_interval=1)
+refresh
```
-```{.python.marimo}
-import altair as alt
-import marimo as mo
-import pandas as pd
-import requests
-from time import time
-from vega_datasets import data
-
-pd.options.display.max_rows = 30
+```python {.marimo}
+print(refresh.value)
```
\ No newline at end of file
diff --git a/generated/examples/ui/refresh.script.py b/generated/examples/ui/refresh.script.py
index cb04ecf..86c96bc 100644
--- a/generated/examples/ui/refresh.script.py
+++ b/generated/examples/ui/refresh.script.py
@@ -1,85 +1,12 @@
-__generated_with = "0.9.34"
+__generated_with = "0.11.0"
# %%
-import altair as alt
import marimo as mo
-import pandas as pd
-import requests
-from time import time
-from vega_datasets import data
-
-pd.options.display.max_rows = 30
-
-# %%
-# load geo data from Vega Datasets
-countries = alt.topo_feature(data.world_110m.url, 'countries')
-
-# world base
-sphere = alt.Chart(alt.sphere()).mark_geoshape(
- fill="aliceblue", stroke="black", strokeWidth=1.5
-)
-
-# world map
-world = alt.Chart(countries).mark_geoshape(
- fill="mintcream", stroke="black", strokeWidth=0.35
-)
-
-# %%
-refresh_interval_slider = mo.ui.slider(start=5, stop=60, step=1, value=10, label="refresh interval (default = 10 sec)")
-n_points_slider = mo.ui.slider(start=5, stop=30, step=1, value=15, label="number of points (default = 15)")
# %%
-refresher = mo.ui.refresh(default_interval=f"{refresh_interval_slider.value}s")
-
-# %%
-def get_iss_positions(refresher=refresher):
- refresher
- timepoints = [int(time())]
- while len(timepoints) <= n_points_slider.value:
- timepoints.append(timepoints[-1] - refresh_interval_slider.value)
- else:
- timepoints.pop(0)
- timepoints_str = str(timepoints)[1:-1].replace(" ", "")
- iss_url = f"https://api.wheretheiss.at/v1/satellites/25544/positions?timestamps={timepoints_str}"
- response = requests.get(iss_url)
- df = pd.DataFrame(response.json())
- df['timestamp'] = pd.to_datetime(df.timestamp, unit='s')
- return df[['timestamp','latitude','longitude','altitude','velocity','visibility']]
-
-# %%
-hover=alt.selection_point(on="mouseover", clear="mouseout")
-
-# iss positions
-iss_df = get_iss_positions()
-iss = alt.Chart(iss_df[['longitude','latitude','timestamp']]).mark_circle(
- stroke='black', size=100,
-).encode(
- longitude=alt.Longitude('longitude:Q'),
- latitude='latitude:Q',
- fill=alt.Fill('timestamp:Q', scale=alt.Scale(scheme='purples'), legend=None),
- strokeWidth=alt.condition(hover, alt.value(3, empty=False), alt.value(0)),
- tooltip=[
- alt.Tooltip('longitude:Q', title='Longitude', format='.4f'),
- alt.Tooltip('latitude:Q', title='Latitude', format='.4f'),
- alt.Tooltip('timestamp:T', title='Timestamp', format='%Y-%m-%d %H:%M:%S')
- ]
-).add_params(hover)
-
-chart = alt.layer(sphere, world, iss).project(type="naturalEarth1").properties(width=640, title="")
+refresh = mo.ui.refresh(default_interval=1)
+refresh
# %%
-mo.hstack([
- mo.vstack([
- mo.md("## Settings | [`marimo.ui.slider`](https://docs.marimo.io/api/inputs/slider.html), [`marimo.ui.refresh`](https://docs.marimo.io/recipes.html#run-a-cell-on-a-timer)\n---"),
- refresh_interval_slider,
- n_points_slider,
- refresher,
- mo.md("## ISS Positions | [`marimo.ui.altair_chart`](https://docs.marimo.io/api/plotting.html#marimo.ui.altair_chart)\n---"),
- mo.as_html(chart).style({"width": "700px"})
- ], align="center"),
- mo.vstack([
- mo.md("## Data | [`marimo.as_html`](https://docs.marimo.io/api/html.html)`(pd.DataFrame)`\n---"),
- mo.as_html(iss_df)
- ])
-], justify="center", wrap=True, gap=3)
\ No newline at end of file
+print(refresh.value)
\ No newline at end of file
diff --git a/generated/examples/ui/table.py.ipynb b/generated/examples/ui/table.py.ipynb
index 1b5d013..d24dcd7 100644
--- a/generated/examples/ui/table.py.ipynb
+++ b/generated/examples/ui/table.py.ipynb
@@ -1,110 +1,25 @@
{
"cells": [
- {
- "cell_type": "markdown",
- "id": "Hbol",
- "metadata": {
- "marimo": {
- "config": {
- "hide_code": true
- }
- }
- },
- "source": [
- "# Tables\n",
- "\n",
- "> “Sometimes I’ll start a sentence and I don’t even know where it’s going. I just hope I find it along the way.”\n",
- "— Michael Scott"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "MJUe",
- "metadata": {
- "marimo": {
- "config": {
- "hide_code": true
- }
- }
- },
- "source": [
- "_Create rich tables with selectable rows using_ `mo.ui.table`."
- ]
- },
- {
- "cell_type": "markdown",
- "id": "vblA",
- "metadata": {},
- "source": [
- "**Single selection.**"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "bkHC",
- "metadata": {},
- "outputs": [],
- "source": [
- "single_select_table = mo.ui.table(\n",
- " office_characters,\n",
- " selection=\"single\",\n",
- " pagination=True,\n",
- ")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "lEQa",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/markdown": [
- "<marimo-tabs data-initial-value='""' data-label='null' data-tabs='["<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">table</span></span>", "<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">selection</span></span>"]'><div data-kind='tab'><marimo-ui-element object-id='bkHC-0' random-id='a9488d99-0bbb-2599-11ce-5dd2b45ed1f0'><marimo-table data-initial-value='[]' data-label='null' data-data='[{"first_name": "Michael", "last_name": "Scott", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;3&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' style='border-radius: 4px' />"}}, {"first_name": "Jim", "last_name": "Halpert", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;7&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Pam", "last_name": "Beesly", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;3&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Dwight", "last_name": "Schrute", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;7&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Angela", "last_name": "Martin", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;5&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Kevin", "last_name": "Malone", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;3&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Oscar", "last_name": "Martinez", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;3&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Stanley", "last_name": "Hudson", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;5&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Phyllis", "last_name": "Vance", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;5&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Meredith", "last_name": "Palmer", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;7&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}]' data-total-rows='20' data-total-columns='1' data-banner-text='""' data-pagination='true' data-page-size='10' data-selection='"single"' data-show-filters='false' data-show-download='true' data-show-column-summaries='true' data-row-headers='[]'></marimo-table></marimo-ui-element></div><div data-kind='tab'><marimo-json-output data-json-data='[]'></marimo-json-output></div></marimo-tabs>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "mo.ui.tabs({\"table\": single_select_table, \"selection\": single_select_table.value})"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "PKri",
- "metadata": {},
- "source": [
- "**Multi-selection.**"
- ]
- },
{
"cell_type": "code",
"execution_count": null,
- "id": "Xref",
+ "id": "Hbol",
"metadata": {},
"outputs": [],
"source": [
- "multi_select_table = mo.ui.table(\n",
- " office_characters,\n",
- " selection=\"multi\",\n",
- " pagination=True,\n",
- ")"
+ "import marimo as mo"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "SFPL",
+ "id": "MJUe",
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
- "<marimo-tabs data-initial-value='""' data-label='null' data-tabs='["<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">table</span></span>", "<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">selection</span></span>"]'><div data-kind='tab'><marimo-ui-element object-id='Xref-0' random-id='ddd1dfb2-3b98-2ef8-daf6-1a26146d3f31'><marimo-table data-initial-value='[]' data-label='null' data-data='[{"first_name": "Michael", "last_name": "Scott", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;3&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' style='border-radius: 4px' />"}}, {"first_name": "Jim", "last_name": "Halpert", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;7&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Pam", "last_name": "Beesly", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;3&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Dwight", "last_name": "Schrute", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;7&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Angela", "last_name": "Martin", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;5&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Kevin", "last_name": "Malone", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;3&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Oscar", "last_name": "Martinez", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;3&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Stanley", "last_name": "Hudson", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;5&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Phyllis", "last_name": "Vance", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;5&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}, {"first_name": "Meredith", "last_name": "Palmer", "skill": {"mimetype": "text/markdown", "data": "&lt;marimo-slider data-initial-value=&#x27;7&#x27; data-label=&#x27;null&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;"}, "favorite place": {"mimetype": "text/html", "data": "<img src='https://picsum.photos/100' />"}}]' data-total-rows='20' data-total-columns='1' data-banner-text='""' data-pagination='true' data-page-size='10' data-selection='"multi"' data-show-filters='false' data-show-download='true' data-show-column-summaries='true' data-row-headers='[]'></marimo-table></marimo-ui-element></div><div data-kind='tab'><marimo-json-output data-json-data='[]'></marimo-json-output></div></marimo-tabs>"
+ "[{'first_name': 'Michael', 'last_name': 'Scott'}, {'first_name': 'Jim', 'last_name': 'Halpert'}, {'first_name': 'Pam', 'last_name': 'Beesly'}]"
]
},
"metadata": {},
@@ -112,182 +27,34 @@
}
],
"source": [
- "mo.ui.tabs({\"table\": multi_select_table, \"selection\": multi_select_table.value})"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "BYtC",
- "metadata": {},
- "source": [
- "**No selection.**"
+ "# ui.table accepts a list of rows as dicts, or a dict mapping column names to values,\n",
+ "# or a dataframe-like object\n",
+ "table = mo.ui.table(\n",
+ " [\n",
+ " {\"first_name\": \"Michael\", \"last_name\": \"Scott\"},\n",
+ " {\"first_name\": \"Jim\", \"last_name\": \"Halpert\"},\n",
+ " {\"first_name\": \"Pam\", \"last_name\": \"Beesly\"},\n",
+ " ]\n",
+ ")\n",
+ "table"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "RGSE",
+ "id": "vblA",
"metadata": {},
"outputs": [
{
"data": {
- "text/markdown": [
- "[{'first_name': 'Michael', 'last_name': 'Scott', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Jim', 'last_name': 'Halpert', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Pam', 'last_name': 'Beesly', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Dwight', 'last_name': 'Schrute', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Angela', 'last_name': 'Martin', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Kevin', 'last_name': 'Malone', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Oscar', 'last_name': 'Martinez', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Stanley', 'last_name': 'Hudson', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Phyllis', 'last_name': 'Vance', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Meredith', 'last_name': 'Palmer', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Creed', 'last_name': 'Bratton', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Ryan', 'last_name': 'Howard', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Kelly', 'last_name': 'Kapoor', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Toby', 'last_name': 'Flenderson', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Darryl', 'last_name': 'Philbin', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Erin', 'last_name': 'Hannon', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Andy', 'last_name': 'Bernard', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Jan', 'last_name': 'Levinson', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'David', 'last_name': 'Wallace', 'skill': slider(), 'favorite place': Html()}, {'first_name': 'Holly', 'last_name': 'Flax', 'skill': slider(), 'favorite place': Html()}]"
- ]
+ "application/json": "[]"
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
- "table = mo.ui.table(\n",
- " office_characters,\n",
- " label=\"Employees\",\n",
- " selection=None,\n",
- ")\n",
- "\n",
- "table"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "Kclp",
- "metadata": {},
- "outputs": [],
- "source": [
- "office_characters = [\n",
- " {\n",
- " \"first_name\": \"Michael\",\n",
- " \"last_name\": \"Scott\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=3),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\", rounded=True),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Jim\",\n",
- " \"last_name\": \"Halpert\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=7),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Pam\",\n",
- " \"last_name\": \"Beesly\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=3),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Dwight\",\n",
- " \"last_name\": \"Schrute\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=7),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Angela\",\n",
- " \"last_name\": \"Martin\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=5),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Kevin\",\n",
- " \"last_name\": \"Malone\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=3),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Oscar\",\n",
- " \"last_name\": \"Martinez\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=3),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Stanley\",\n",
- " \"last_name\": \"Hudson\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=5),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Phyllis\",\n",
- " \"last_name\": \"Vance\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=5),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Meredith\",\n",
- " \"last_name\": \"Palmer\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=7),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Creed\",\n",
- " \"last_name\": \"Bratton\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=3),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Ryan\",\n",
- " \"last_name\": \"Howard\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=5),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Kelly\",\n",
- " \"last_name\": \"Kapoor\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=3),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Toby\",\n",
- " \"last_name\": \"Flenderson\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=3),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Darryl\",\n",
- " \"last_name\": \"Philbin\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=7),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Erin\",\n",
- " \"last_name\": \"Hannon\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=5),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Andy\",\n",
- " \"last_name\": \"Bernard\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=5),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Jan\",\n",
- " \"last_name\": \"Levinson\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=5),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"David\",\n",
- " \"last_name\": \"Wallace\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=3),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- " {\n",
- " \"first_name\": \"Holly\",\n",
- " \"last_name\": \"Flax\",\n",
- " \"skill\": mo.ui.slider(1, 10, value=7),\n",
- " \"favorite place\": mo.image(src=\"https://picsum.photos/100\"),\n",
- " },\n",
- "]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "emfo",
- "metadata": {},
- "outputs": [],
- "source": [
- "import marimo as mo"
+ "table.value"
]
}
],
diff --git a/generated/examples/ui/table.py.md b/generated/examples/ui/table.py.md
index ce6c202..16f724a 100644
--- a/generated/examples/ui/table.py.md
+++ b/generated/examples/ui/table.py.md
@@ -1,180 +1,25 @@
---
title: Table
-marimo-version: 0.9.34
+marimo-version: 0.11.0
---
-# Tables
-
-> “Sometimes I’ll start a sentence and I don’t even know where it’s going. I just hope I find it along the way.”
-— Michael Scott
-
-_Create rich tables with selectable rows using_ `mo.ui.table`.
-
-**Single selection.**
-
-```{.python.marimo}
-single_select_table = mo.ui.table(
- office_characters,
- selection="single",
- pagination=True,
-)
-```
-
-```{.python.marimo}
-mo.ui.tabs({"table": single_select_table, "selection": single_select_table.value})
-```
-
-**Multi-selection.**
-
-```{.python.marimo}
-multi_select_table = mo.ui.table(
- office_characters,
- selection="multi",
- pagination=True,
-)
-```
-
-```{.python.marimo}
-mo.ui.tabs({"table": multi_select_table, "selection": multi_select_table.value})
+```python {.marimo}
+import marimo as mo
```
-**No selection.**
-
-```{.python.marimo}
+```python {.marimo}
+# ui.table accepts a list of rows as dicts, or a dict mapping column names to values,
+# or a dataframe-like object
table = mo.ui.table(
- office_characters,
- label="Employees",
- selection=None,
+ [
+ {"first_name": "Michael", "last_name": "Scott"},
+ {"first_name": "Jim", "last_name": "Halpert"},
+ {"first_name": "Pam", "last_name": "Beesly"},
+ ]
)
-
table
```
-```{.python.marimo}
-office_characters = [
- {
- "first_name": "Michael",
- "last_name": "Scott",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100", rounded=True),
- },
- {
- "first_name": "Jim",
- "last_name": "Halpert",
- "skill": mo.ui.slider(1, 10, value=7),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Pam",
- "last_name": "Beesly",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Dwight",
- "last_name": "Schrute",
- "skill": mo.ui.slider(1, 10, value=7),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Angela",
- "last_name": "Martin",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Kevin",
- "last_name": "Malone",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Oscar",
- "last_name": "Martinez",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Stanley",
- "last_name": "Hudson",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Phyllis",
- "last_name": "Vance",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Meredith",
- "last_name": "Palmer",
- "skill": mo.ui.slider(1, 10, value=7),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Creed",
- "last_name": "Bratton",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Ryan",
- "last_name": "Howard",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Kelly",
- "last_name": "Kapoor",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Toby",
- "last_name": "Flenderson",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Darryl",
- "last_name": "Philbin",
- "skill": mo.ui.slider(1, 10, value=7),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Erin",
- "last_name": "Hannon",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Andy",
- "last_name": "Bernard",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Jan",
- "last_name": "Levinson",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "David",
- "last_name": "Wallace",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Holly",
- "last_name": "Flax",
- "skill": mo.ui.slider(1, 10, value=7),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
-]
-```
-
-```{.python.marimo}
-import marimo as mo
+```python {.marimo}
+table.value
```
\ No newline at end of file
diff --git a/generated/examples/ui/table.script.py b/generated/examples/ui/table.script.py
index b8fed10..baa5905 100644
--- a/generated/examples/ui/table.script.py
+++ b/generated/examples/ui/table.script.py
@@ -1,180 +1,20 @@
-__generated_with = "0.9.34"
+__generated_with = "0.11.0"
# %%
import marimo as mo
# %%
-mo.md(
- """
- # Tables
-
- > “Sometimes I’ll start a sentence and I don’t even know where it’s going. I just hope I find it along the way.”
- — Michael Scott
- """
-)
-
-# %%
-mo.md("""_Create rich tables with selectable rows using_ `mo.ui.table`.""")
-
-# %%
-mo.md("""**Single selection.**""")
-
-# %%
-mo.md("""**Multi-selection.**""")
-
-# %%
-mo.md("""**No selection.**""")
-
-# %%
-office_characters = [
- {
- "first_name": "Michael",
- "last_name": "Scott",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100", rounded=True),
- },
- {
- "first_name": "Jim",
- "last_name": "Halpert",
- "skill": mo.ui.slider(1, 10, value=7),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Pam",
- "last_name": "Beesly",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Dwight",
- "last_name": "Schrute",
- "skill": mo.ui.slider(1, 10, value=7),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Angela",
- "last_name": "Martin",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Kevin",
- "last_name": "Malone",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Oscar",
- "last_name": "Martinez",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Stanley",
- "last_name": "Hudson",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Phyllis",
- "last_name": "Vance",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Meredith",
- "last_name": "Palmer",
- "skill": mo.ui.slider(1, 10, value=7),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Creed",
- "last_name": "Bratton",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Ryan",
- "last_name": "Howard",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Kelly",
- "last_name": "Kapoor",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Toby",
- "last_name": "Flenderson",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Darryl",
- "last_name": "Philbin",
- "skill": mo.ui.slider(1, 10, value=7),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Erin",
- "last_name": "Hannon",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Andy",
- "last_name": "Bernard",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Jan",
- "last_name": "Levinson",
- "skill": mo.ui.slider(1, 10, value=5),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "David",
- "last_name": "Wallace",
- "skill": mo.ui.slider(1, 10, value=3),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
- {
- "first_name": "Holly",
- "last_name": "Flax",
- "skill": mo.ui.slider(1, 10, value=7),
- "favorite place": mo.image(src="https://picsum.photos/100"),
- },
-]
-
-# %%
-single_select_table = mo.ui.table(
- office_characters,
- selection="single",
- pagination=True,
-)
-
-# %%
-mo.ui.tabs({"table": single_select_table, "selection": single_select_table.value})
-
-# %%
-multi_select_table = mo.ui.table(
- office_characters,
- selection="multi",
- pagination=True,
-)
-
-# %%
-mo.ui.tabs({"table": multi_select_table, "selection": multi_select_table.value})
-
-# %%
+# ui.table accepts a list of rows as dicts, or a dict mapping column names to values,
+# or a dataframe-like object
table = mo.ui.table(
- office_characters,
- label="Employees",
- selection=None,
+ [
+ {"first_name": "Michael", "last_name": "Scott"},
+ {"first_name": "Jim", "last_name": "Halpert"},
+ {"first_name": "Pam", "last_name": "Beesly"},
+ ]
)
+table
-table
\ No newline at end of file
+# %%
+table.value
\ No newline at end of file
diff --git a/generated/examples/ui/tabs.py.ipynb b/generated/examples/ui/tabs.py.ipynb
index f8f1308..1cfb8e6 100644
--- a/generated/examples/ui/tabs.py.ipynb
+++ b/generated/examples/ui/tabs.py.ipynb
@@ -1,43 +1,25 @@
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "code",
+ "execution_count": null,
"id": "Hbol",
- "metadata": {
- "marimo": {
- "config": {
- "hide_code": true
- }
- }
- },
- "source": [
- "# Tabs"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "MJUe",
- "metadata": {
- "marimo": {
- "config": {
- "hide_code": true
- }
- }
- },
+ "metadata": {},
+ "outputs": [],
"source": [
- "Use `mo.ui.tabs` to organize outputs."
+ "import marimo as mo"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "vblA",
+ "id": "MJUe",
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
- "<marimo-tabs data-initial-value='""' data-label='null' data-tabs='["<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">\ud83e\uddd9\u200d\u2640 User</span></span>", "<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">\ud83c\udfe2 Organization</span></span>"]'><div data-kind='tab'><div style='display: flex;flex: 1;flex-direction: column;justify-content: flex-start;align-items: normal;flex-wrap: nowrap;gap: 0.5rem'><div><span class="markdown prose dark:prose-invert"><span class="paragraph">Edit User</span></span></div><div><marimo-ui-element object-id='vblA-0' random-id='bdd640fb-0667-1ad1-1c80-317fa3b1799d'><marimo-text data-initial-value='""' data-label='"<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">First Name</span></span>"' data-placeholder='""' data-kind='"text"' data-full-width='false' data-disabled='false' data-debounce='true'></marimo-text></marimo-ui-element></div><div><marimo-ui-element object-id='vblA-1' random-id='23b8c1e9-3924-56de-3eb1-3b9046685257'><marimo-text data-initial-value='""' data-label='"<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">Last Name</span></span>"' data-placeholder='""' data-kind='"text"' data-full-width='false' data-disabled='false' data-debounce='true'></marimo-text></marimo-ui-element></div></div></div><div data-kind='tab'><div style='display: flex;flex: 1;flex-direction: column;justify-content: flex-start;align-items: normal;flex-wrap: nowrap;gap: 0.5rem'><div><span class="markdown prose dark:prose-invert"><span class="paragraph">Edit Organization</span></span></div><div><marimo-ui-element object-id='vblA-2' random-id='bd9c66b3-ad3c-2d6d-1a3d-1fa7bc8960a9'><marimo-text data-initial-value='"..."' data-label='"<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">Organization Name</span></span>"' data-placeholder='""' data-kind='"text"' data-full-width='false' data-disabled='false' data-debounce='true'></marimo-text></marimo-ui-element></div><div><marimo-ui-element object-id='vblA-3' random-id='972a8469-1641-9f82-8b9d-2434e465e150'><marimo-number data-initial-value='0' data-label='"<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">Number of Employees</span></span>"' data-start='0' data-stop='1000' data-debounce='false' data-full-width='false'></marimo-number></marimo-ui-element></div></div></div></marimo-tabs>"
+ "<marimo-tabs data-initial-value='""' data-label='null' data-tabs='["<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">Bob says</span></span>", "<span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">Alice says</span></span>"]'><div data-kind='tab'><span class="markdown prose dark:prose-invert"><span class="paragraph">Hello, Alice! 👋</span></span></div><div data-kind='tab'><span class="markdown prose dark:prose-invert"><span class="paragraph">Hello, Bob! 👋</span></span></div></marimo-tabs>"
]
},
"metadata": {},
@@ -45,57 +27,31 @@
}
],
"source": [
- "settings = mo.vstack(\n",
- " [\n",
- " mo.md(\"Edit User\"),\n",
- " first := mo.ui.text(label=\"First Name\"),\n",
- " last := mo.ui.text(label=\"Last Name\"),\n",
- " ]\n",
- ")\n",
- "\n",
- "organization = mo.vstack(\n",
- " [\n",
- " mo.md(\"Edit Organization\"),\n",
- " org := mo.ui.text(label=\"Organization Name\", value=\"...\"),\n",
- " employees := mo.ui.number(\n",
- " label=\"Number of Employees\", start=0, stop=1000\n",
- " ),\n",
- " ]\n",
- ")\n",
- "\n",
- "mo.ui.tabs(\n",
- " {\n",
- " \"🧙♀ User\": settings,\n",
- " \"🏢 Organization\": organization,\n",
- " }\n",
- ")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "bkHC",
- "metadata": {},
- "outputs": [],
- "source": [
- "mo.md(\n",
- " f\"\"\"\n",
- " Welcome **{first.value} {last.value}** to **{org.value}**! You are \n",
- " employee no. **{employees.value + 1}**.\n",
- "\n",
- " #{\"🎉\" * (min(employees.value + 1, 1000))} \n",
- " \"\"\"\n",
- ") if all([first.value, last.value, org.value]) else None"
+ "tabs = mo.ui.tabs({\n",
+ " \"Bob says\": mo.md(\"Hello, Alice! 👋\"),\n",
+ " \"Alice says\": mo.md(\"Hello, Bob! 👋\")\n",
+ "})\n",
+ "tabs"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "lEQa",
+ "id": "vblA",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "'Bob says'
"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
"source": [
- "import marimo as mo"
+ "tabs.value"
]
}
],
diff --git a/generated/examples/ui/tabs.py.md b/generated/examples/ui/tabs.py.md
index 11ba923..aa1a0ce 100644
--- a/generated/examples/ui/tabs.py.md
+++ b/generated/examples/ui/tabs.py.md
@@ -1,50 +1,20 @@
---
title: Tabs
-marimo-version: 0.9.34
+marimo-version: 0.11.0
---
-# Tabs
-
-Use `mo.ui.tabs` to organize outputs.
-
-```{.python.marimo}
-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,
- }
-)
+```python {.marimo}
+import marimo as mo
```
-```{.python.marimo}
-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 None
+```python {.marimo}
+tabs = mo.ui.tabs({
+ "Bob says": mo.md("Hello, Alice! 👋"),
+ "Alice says": mo.md("Hello, Bob! 👋")
+})
+tabs
```
-```{.python.marimo}
-import marimo as mo
+```python {.marimo}
+tabs.value
```
\ No newline at end of file
diff --git a/generated/examples/ui/tabs.script.py b/generated/examples/ui/tabs.script.py
index 2025fa2..37f5d29 100644
--- a/generated/examples/ui/tabs.script.py
+++ b/generated/examples/ui/tabs.script.py
@@ -1,47 +1,15 @@
-__generated_with = "0.9.34"
+__generated_with = "0.11.0"
# %%
import marimo as mo
# %%
-mo.md("""# Tabs""")
+tabs = mo.ui.tabs({
+ "Bob says": mo.md("Hello, Alice! 👋"),
+ "Alice says": mo.md("Hello, Bob! 👋")
+})
+tabs
# %%
-mo.md("""Use `mo.ui.tabs` to organize outputs.""")
-
-# %%
-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,
- }
-)
-
-# %%
-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 None
\ No newline at end of file
+tabs.value
\ No newline at end of file
diff --git a/public/examples/ui/.nojekyll b/public/examples/ui/.nojekyll
new file mode 100644
index 0000000..e69de29
diff --git a/public/examples/ui/android-chrome-192x192.png b/public/examples/ui/android-chrome-192x192.png
new file mode 100644
index 0000000..b8e595c
Binary files /dev/null and b/public/examples/ui/android-chrome-192x192.png differ
diff --git a/public/examples/ui/android-chrome-512x512.png b/public/examples/ui/android-chrome-512x512.png
new file mode 100644
index 0000000..0667fbd
Binary files /dev/null and b/public/examples/ui/android-chrome-512x512.png differ
diff --git a/public/examples/ui/apple-touch-icon.png b/public/examples/ui/apple-touch-icon.png
new file mode 100644
index 0000000..b2a013b
Binary files /dev/null and b/public/examples/ui/apple-touch-icon.png differ
diff --git a/public/examples/ui/arrays_and_dicts.py.html b/public/examples/ui/arrays_and_dicts.py.html
index 5af041a..623fa4f 100644
--- a/public/examples/ui/arrays_and_dicts.py.html
+++ b/public/examples/ui/arrays_and_dicts.py.html
@@ -2,24 +2,24 @@
-
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
arrays_and_dicts.py
-
-
+
+
arrays and dicts
-
-
+
+
@@ -74,9 +74,9 @@
- import%20marimo%0A%0A__generated_with%20%3D%20%220.9.34%22%0Aapp%20%3D%20marimo.App()%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20__(mo)%3A%0A%20%20%20%20mo.md(%22%22%22%23%20Arrays%20and%20Dictionaries%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20__(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20Use%20%60mo.ui.array%60%20and%20%60mo.ui.dictionary%60%20to%20create%20UI%20elements%20that%20wrap%20%0A%20%20%20%20%20%20%20%20other%20elements.%0A%0A%20%20%20%20%20%20%20%20Because%20UI%20elements%20must%20be%20assigned%20to%20global%20variables%2C%20%0A%20%20%20%20%20%20%20%20these%20functions%20are%20required%20when%20the%20set%20of%20elements%20to%20create%20is%20not%0A%20%20%20%20%20%20%20%20known%20until%20runtime.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20__(mo)%3A%0A%20%20%20%20create%20%3D%20mo.ui.button(label%3D%22Create%20new%20collections%22)%0A%20%20%20%20return%20(create%2C)%0A%0A%0A%40app.cell%0Adef%20__(create)%3A%0A%20%20%20%20create.center()%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20__(mo)%3A%0A%20%20%20%20mo.md(%22%22%22UI%20Elements%20...%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20__(create%2C%20mo%2C%20random)%3A%0A%20%20%20%20create%0A%0A%20%20%20%20array%20%3D%20mo.ui.array(%0A%20%20%20%20%20%20%20%20%5Bmo.ui.text()%5D%0A%20%20%20%20%20%20%20%20%2B%20%5Bmo.ui.slider(1%2C%2010)%20for%20_%20in%20range(0%2C%20random.randint(2%2C%205))%5D%2C%0A%20%20%20%20)%0A%20%20%20%20dictionary%20%3D%20mo.ui.dictionary(%0A%20%20%20%20%20%20%20%20%7Bstr(i)%3A%20mo.ui.slider(1%2C%2010)%20for%20i%20in%20range(0%2C%20random.randint(2%2C%205))%7D%0A%20%20%20%20)%0A%0A%20%20%20%20mo.hstack(%5Barray%2C%20dictionary%5D%2C%20justify%3D%22space-around%22)%0A%20%20%20%20return%20array%2C%20dictionary%0A%0A%0A%40app.cell%0Adef%20__(mo)%3A%0A%20%20%20%20mo.md(%22%22%22...%20and%20their%20values%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20__(array%2C%20dictionary%2C%20mo)%3A%0A%20%20%20%20mo.hstack(%5Barray.value%2C%20dictionary.value%5D%2C%20justify%3D%22space-around%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20__(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20Key%20difference%20between%20marimo%20dict%20and%20standard%20python%20dict%3A%0A%0A%20%20%20%20%20%20%20%20The%20main%20reason%20to%20use%20%60mo.ui.dictionary%60%20is%20for%20reactive%20execution%20%E2%80%94%20when%20you%20interact%20with%20an%20element%20in%20a%20%60mo.ui.dictionary%60%2C%20all%20cells%20that%20reference%20the%20%60mo.ui.dictionary%60%20run%20automatically%2C%20just%20like%20all%20other%20ui%20elements.%20When%20you%20use%20a%20regular%20dictionary%2C%20you%20don't%20get%20this%20reactivity.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20__(create%2C%20mo)%3A%0A%20%20%20%20create%0A%0A%20%20%20%20slider%20%3D%20mo.ui.slider(1%2C%2010%2C%20show_value%3DTrue)%0A%20%20%20%20text%20%3D%20mo.ui.text()%0A%20%20%20%20date%20%3D%20mo.ui.date()%0A%0A%20%20%20%20mo_d%20%3D%20mo.ui.dictionary(%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22slider%22%3A%20slider%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22text%22%3A%20text%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22date%22%3A%20date%2C%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20)%0A%0A%20%20%20%20py_d%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%22slider%22%3A%20slider%2C%0A%20%20%20%20%20%20%20%20%22text%22%3A%20text%2C%0A%20%20%20%20%20%20%20%20%22date%22%3A%20date%2C%0A%20%20%20%20%7D%0A%0A%20%20%20%20mo.hstack(%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.vstack(%5B%22marimo%20dict%22%2C%20mo_d%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.vstack(%5B%22original%20elements%22%2C%20mo.vstack(%5Bslider%2C%20text%2C%20date%5D)%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.vstack(%5B%22python%20dict%22%2C%20py_d%5D)%2C%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20justify%3D%22space-around%22%2C%0A%20%20%20%20)%0A%20%20%20%20return%20date%2C%20mo_d%2C%20py_d%2C%20slider%2C%20text%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20__(mo%2C%20mo_d%2C%20py_d)%3A%0A%20%20%20%20mo_d_ref%20%3D%20%7Bk%3A%20mo_d%5Bk%5D.value%20for%20k%20in%20mo_d.value.keys()%7D%0A%20%20%20%20py_d_ref%20%3D%20%7Bk%3A%20py_d%5Bk%5D.value%20for%20k%20in%20py_d.keys()%7D%0A%20%20%20%20mo.hstack(%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.vstack(%5B%22reference%20of%20marimo%20dict%22%2C%20mo_d_ref%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.vstack(%5B%22reference%20of%20python%20dict%22%2C%20py_d_ref%5D)%2C%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20justify%3D%22space-around%22%2C%0A%20%20%20%20)%0A%20%20%20%20return%20mo_d_ref%2C%20py_d_ref%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20__(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Notice%20that%20when%20you%20interact%20with%20the%20UI%20elements%20in%20the%20marimo%20dict%2C%20the%20reference%20of%20marimo%20dict%20updates%20automatically.%20However%2C%20when%20you%20interact%20with%20the%20elements%20in%20the%20python%20dict%2C%20you%20need%20to%20manually%20re-run%20the%20cell%20to%20see%20the%20updated%20values.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20__()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20import%20random%0A%20%20%20%20return%20mo%2C%20random%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
+ import%20marimo%0A%0A__generated_with%20%3D%20%220.11.0%22%0Aapp%20%3D%20marimo.App()%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20import%20random%0A%20%20%20%20return%20mo%2C%20random%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22%23%20Arrays%20and%20Dictionaries%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20Use%20%60mo.ui.array%60%20and%20%60mo.ui.dictionary%60%20to%20create%20UI%20elements%20that%20wrap%20%0A%20%20%20%20%20%20%20%20other%20elements.%0A%0A%20%20%20%20%20%20%20%20Because%20UI%20elements%20must%20be%20assigned%20to%20global%20variables%2C%20%0A%20%20%20%20%20%20%20%20these%20functions%20are%20required%20when%20the%20set%20of%20elements%20to%20create%20is%20not%0A%20%20%20%20%20%20%20%20known%20until%20runtime.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20create%20%3D%20mo.ui.button(label%3D%22Create%20new%20collections%22)%0A%20%20%20%20return%20(create%2C)%0A%0A%0A%40app.cell%0Adef%20_(create)%3A%0A%20%20%20%20create.center()%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22UI%20Elements%20...%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(create%2C%20mo%2C%20random)%3A%0A%20%20%20%20create%0A%0A%20%20%20%20array%20%3D%20mo.ui.array(%0A%20%20%20%20%20%20%20%20%5Bmo.ui.text()%5D%0A%20%20%20%20%20%20%20%20%2B%20%5Bmo.ui.slider(1%2C%2010)%20for%20_%20in%20range(0%2C%20random.randint(2%2C%205))%5D%2C%0A%20%20%20%20)%0A%20%20%20%20dictionary%20%3D%20mo.ui.dictionary(%0A%20%20%20%20%20%20%20%20%7Bstr(i)%3A%20mo.ui.slider(1%2C%2010)%20for%20i%20in%20range(0%2C%20random.randint(2%2C%205))%7D%0A%20%20%20%20)%0A%0A%20%20%20%20mo.hstack(%5Barray%2C%20dictionary%5D%2C%20justify%3D%22space-around%22)%0A%20%20%20%20return%20array%2C%20dictionary%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22...%20and%20their%20values%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(array%2C%20dictionary%2C%20mo)%3A%0A%20%20%20%20mo.hstack(%5Barray.value%2C%20dictionary.value%5D%2C%20justify%3D%22space-around%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20Key%20difference%20between%20marimo%20dict%20and%20standard%20python%20dict%3A%0A%0A%20%20%20%20%20%20%20%20The%20main%20reason%20to%20use%20%60mo.ui.dictionary%60%20is%20for%20reactive%20execution%20%E2%80%94%20when%20you%20interact%20with%20an%20element%20in%20a%20%60mo.ui.dictionary%60%2C%20all%20cells%20that%20reference%20the%20%60mo.ui.dictionary%60%20run%20automatically%2C%20just%20like%20all%20other%20ui%20elements.%20When%20you%20use%20a%20regular%20dictionary%2C%20you%20don't%20get%20this%20reactivity.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(create%2C%20mo)%3A%0A%20%20%20%20create%0A%0A%20%20%20%20slider%20%3D%20mo.ui.slider(1%2C%2010%2C%20show_value%3DTrue)%0A%20%20%20%20text%20%3D%20mo.ui.text()%0A%20%20%20%20date%20%3D%20mo.ui.date()%0A%0A%20%20%20%20mo_d%20%3D%20mo.ui.dictionary(%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22slider%22%3A%20slider%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22text%22%3A%20text%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22date%22%3A%20date%2C%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20)%0A%0A%20%20%20%20py_d%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%22slider%22%3A%20slider%2C%0A%20%20%20%20%20%20%20%20%22text%22%3A%20text%2C%0A%20%20%20%20%20%20%20%20%22date%22%3A%20date%2C%0A%20%20%20%20%7D%0A%0A%20%20%20%20mo.hstack(%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.vstack(%5B%22marimo%20dict%22%2C%20mo_d%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.vstack(%5B%22original%20elements%22%2C%20mo.vstack(%5Bslider%2C%20text%2C%20date%5D)%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.vstack(%5B%22python%20dict%22%2C%20py_d%5D)%2C%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20justify%3D%22space-around%22%2C%0A%20%20%20%20)%0A%20%20%20%20return%20date%2C%20mo_d%2C%20py_d%2C%20slider%2C%20text%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo%2C%20mo_d%2C%20py_d)%3A%0A%20%20%20%20mo_d_ref%20%3D%20%7Bk%3A%20mo_d%5Bk%5D.value%20for%20k%20in%20mo_d.value.keys()%7D%0A%20%20%20%20py_d_ref%20%3D%20%7Bk%3A%20py_d%5Bk%5D.value%20for%20k%20in%20py_d.keys()%7D%0A%20%20%20%20mo.hstack(%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.vstack(%5B%22reference%20of%20marimo%20dict%22%2C%20mo_d_ref%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.vstack(%5B%22reference%20of%20python%20dict%22%2C%20py_d_ref%5D)%2C%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20justify%3D%22space-around%22%2C%0A%20%20%20%20)%0A%20%20%20%20return%20mo_d_ref%2C%20py_d_ref%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22Notice%20that%20when%20you%20interact%20with%20the%20UI%20elements%20in%20the%20marimo%20dict%2C%20the%20reference%20of%20marimo%20dict%20updates%20automatically.%20However%2C%20when%20you%20interact%20with%20the%20elements%20in%20the%20python%20dict%2C%20you%20need%20to%20manually%20re-run%20the%20cell%20to%20see%20the%20updated%20values.%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
-254f85f549135261cea3424d1c89f5a364e5886a49e35dd0e7f1e821d81da0b6
+0f41b8090e8ada78a0267a4ffb69ba80f7955595a230ac91e9ce74f214696d2b