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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
docs: Add `button.py` and modify preview (#3342)
Srihari Thyagarajan2ecd53e21312
diff --git a/docs/api/inputs/button.md b/docs/api/inputs/button.mdindex 15fae0b2a6..a4c60359bb 100644--- a/docs/api/inputs/button.md+++ b/docs/api/inputs/button.md@@ -4,15 +4,9 @@If you're looking for a button to trigger computation on click, considerusing [`mo.ui.run_button`][marimo.ui.run_button].-/// marimo-embed--```python-def __():- mo.ui.button(label="Click me")- return-```+/// marimo-embed-file+ filepath: examples/ui/button.py///-::: marimo.ui.button+::: marimo.ui.button\ No newline at end of filediff --git a/examples/ui/button.py b/examples/ui/button.pynew file mode 100644index 0000000000..28b07610f9--- /dev/null+++ b/examples/ui/button.py@@ -0,0 +1,29 @@+import marimo++__generated_with = "0.10.6"+app = marimo.App()+++def _():+ import marimo as mo+ return (mo,)+++def _(mo):+ button = mo.ui.button(+ value=0, on_click=lambda value: value + 1, label="increment", kind="warn"+ )+ button+ return (button,)+++def _(button):+ button.value+ return+++if __name__ == "__main__":+ app.run()