Static reactivity demo¶
This page shows the precompute.enabled: true feature in action.
The slider below is a real mo.ui.slider, but the page is fully
static — there is no Python kernel running. The output updates
because marimo-book pre-rendered the notebook once per slider
value at build time and embedded the results as a JSON lookup
table.
Drag the slider to change the temperature reading.
| Scale | Value |
|---|---|
| Celsius | -10 °C |
| Fahrenheit | 14.0 °F |
| Kelvin | 263.15 K |
| Subjective | freezing |
How this works¶
The author wrote a normal marimo notebook. The slider uses marimo's
own steps=[-10, 0, 10, 20, 25, 30, 40, 100] API to declare a
discrete value set — no marimo-book imports, no special markup.
With precompute.enabled: true in book.yml, the preprocessor:
- Found the slider via AST scan (eight discrete values).
- Re-ran
marimo export ipynbonce per non-default value. - Diffed the rendered cells across versions to find which output changed (just the temperature-table cell).
- Embedded a small JSON lookup table in the page.
- A small JS shim swaps the table's HTML when you drag the slider.
See Building → Static reactivity for the full feature walkthrough, including the caps that protect against runaway builds.