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: grid layout, update layout api, update stale image (#903)
Akshay Agrawal11f6107d556b
diff --git a/docs/_static/docs-html-export.png b/docs/_static/docs-html-export.pngindex 80bce8bff5..55af505343 100644Binary files a/docs/_static/docs-html-export.png and b/docs/_static/docs-html-export.png differdiff --git a/docs/api/layouts/index.md b/docs/api/layouts/index.mdindex 31bec7d4c4..45bf61f895 100644--- a/docs/api/layouts/index.md+++ b/docs/api/layouts/index.md@@ -12,9 +12,13 @@tree```-marimo has higher-order layout elements. Unlike elements in `marimo.ui`, these-don't have any values associated with them but just render their children in a-certain way.+marimo has higher-order layout functions that you can use to arrange outputs+in rows, columns, tables, tabs, and more.++## Stateless++Unlike elements in `marimo.ui`, these don't have any values associated with+them but just render their children in a certain way.```{eval-rst}.. autosummary::@@ -29,3 +33,17 @@ certain way.marimo.treemarimo.vstack```++## Stateful++Some elements in `marimo.ui` are also helpful for layout. These elements+do have values associated with them: for example, `tabs` tracks the+selected tab name, and `table` tracks the selected rows.++```{eval-rst}+.. autosummary::+ :nosignatures:++ marimo.ui.tabs+ marimo.ui.table+```diff --git a/docs/guides/apps.md b/docs/guides/apps.mdindex 1317b2e219..ccd905ea47 100644--- a/docs/guides/apps.md+++ b/docs/guides/apps.md@@ -1,7 +1,14 @@# Run as an app-The marimo CLI lets you run any notebook as an app: `marimo run` hides the-notebook's code and starts a web server that hosts the resulting app.+The marimo CLI lets you run any notebook as an app: `marimo run` lays out+the notebook as an app and starts a web server that hosts the resulting app.++By default, apps are laid out as a concetentation of their outputs, with+code hidden. You can customize the layout using marimo's built-in drag-and-drop+grid editor; you can also choose to include code in the app view.+++## CLI```Usage: marimo run [OPTIONS] NAME@@ -22,3 +29,40 @@ Options:--base-url TEXT Base URL for the server. Should start with a /.--help Show this message and exit.```++## Layout++While editing a notebook with `marimo edit`, you can preview the notebook+as an app by clicking the preview button in the bottom-left of the editor.+(You can also use the command palette.)+++### Vertical layout++The default layout is the vertical layout: cell outputs are concatenated+vertically and code is hidden. When combined with marimo's [built-in functions+for laying out outputs](../api/layouts/index.md), as well as its configurable+app widths (configure via the notebook settings menu), the vertical layout can+successfully support a wide breadth of application user interfaces.++### Grid layout++If you prefer a drag-and-drop experience over+[programmatic layout](../api/layouts/index.md), consider using marimo's grid+editor for making your apps: with this editor, you simply drag outputs onto a+grid to arrange them on the page.++Enable the grid editor in the app preview, via a dropdown:++<div align="center">+<figure>+<blockquote class="twitter-tweet" data-media-max-width="560"><p lang="en" dir="ltr">New feature! Drag-and-drop notebook outputs to build an app using our grid editor.<br><br>Shipping in our next release — stay tuned! <a href="https://t.co/DQpstGAmKh">pic.twitter.com/DQpstGAmKh</a></p>— marimo (@marimo_io) <a href="https://twitter.com/marimo_io/status/1762595771504116221?ref_src=twsrc%5Etfw">February 27, 2024</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>+</figure>+<figcaption>Grid layout lets you drag and drop outputs to construct your app</figcaption>+</div>++marimo saves metadata about your constructed layout in a `layouts` folder;+make sure to include this folder when sharing your notebook so that others+can reconstruct your layout.++