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.

example: character count (#83)

Akshay Agrawal3319a29e30be
diff --git a/examples/character_count.py b/examples/character_count.py
new file mode 100644
index 0000000000..c11d8e4b34
--- /dev/null
+++ b/examples/character_count.py
@@ -0,0 +1,37 @@
+import marimo
+
+__generated_with = "0.1.5"
+app = marimo.App()
+
+
+def __():
+ import marimo as mo
+ return mo,
+
+
+def __(mo):
+ mo.md("# Character Count").left()
+ return
+
+
+def __(mo):
+ text = mo.ui.text_area(placeholder="Enter text ...", label="Character count")
+ return text,
+
+
+def __(mo, text):
+ mo.hstack(
+ [text, mo.md(f"`{len(text.value)} characters`")],
+ justify="start",
+ align="end",
+ gap=1,
+ )
+ return
+
+
+if __name__ == "__main__":
+ app.run()