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.

docs: add mo.stat (#4267)

Shahmir Varqha3868197f59b4
diff --git a/docs/api/layouts/index.md b/docs/api/layouts/index.md
index 421153ffdb..28487b5262 100644
--- a/docs/api/layouts/index.md
+++ b/docs/api/layouts/index.md
@@ -21,6 +21,7 @@ them but just render their children in a certain way.
| [`marimo.plain`][marimo.plain] | Display content without styling |
| [`marimo.right`][marimo.right] | Right-align content |
| [`marimo.routes`][marimo.routes] | Create page routing |
+| [`marimo.stat`][marimo.stat] | Display statistics |
| [`marimo.sidebar`][marimo.sidebar] | Create sidebars |
| [`marimo.tree`][marimo.tree] | Create tree structures |
| [`marimo.vstack`][marimo.vstack] | Stack elements vertically |
diff --git a/docs/api/layouts/stat.md b/docs/api/layouts/stat.md
new file mode 100644
index 0000000000..dd6fb04d1e
--- /dev/null
+++ b/docs/api/layouts/stat.md
@@ -0,0 +1,35 @@
+# Stat
+
+/// marimo-embed
+
+```python
+def __():
+ active_users = mo.stat(
+ value="1.2M",
+ label="Active Users",
+ caption="12% from last month",
+ direction="increase"
+ )
+
+ revenue = mo.stat(
+ value="$4.5M",
+ label="Revenue",
+ caption="8% from last quarter",
+ direction="increase"
+ )
+
+ conversion = mo.stat(
+ value="3.8%",
+ label="Conversion Rate",
+ caption="0.5% from last week",
+ direction="decrease"
+ )
+
+ mo.hstack([active_users, revenue, conversion], justify="center", gap="2rem")
+ return
+```
+
+///
+
+::: marimo.stat
diff --git a/mkdocs.yml b/mkdocs.yml
index 7932aeb03c..cbaa78f25b 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -96,6 +96,7 @@ nav:
- Editor features: guides/editor_features/index.md
- Editor overview: guides/editor_features/overview.md
- AI completion: guides/editor_features/ai_completion.md
+ - Language Server: guides/editor_features/language_server.md
- Package management: guides/editor_features/package_management.md
- Module autoreloading: guides/editor_features/module_autoreloading.md
- Hotkeys: guides/editor_features/hotkeys.md
@@ -194,6 +195,7 @@ nav:
- Plain: api/layouts/plain.md
- Routes: api/layouts/routes.md
- Sidebar: api/layouts/sidebar.md
+ - Stat: api/layouts/stat.md
- Stacks: api/layouts/stacks.md
- Tree: api/layouts/tree.md
- Plotting: api/plotting.md