Skip to content

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

warn against putting ui elements in state (#749)

Akshay Agrawal85ff28cda49b
diff --git a/marimo/_runtime/state.py b/marimo/_runtime/state.py
index bc2e067d37..2f7277ca0d 100644
--- a/marimo/_runtime/state.py
+++ b/marimo/_runtime/state.py
@@ -104,6 +104,9 @@ def state(value: T) -> tuple[State[T], Callable[[T], None]]:
[slider, number]
```
+ **Warning.** Do not store `marimo.ui` elements in state; doing so can
+ lead to hard-to-diagnose bugs.
+
**Args**:
- `value`: initial value of the state