MCPcopy Create free account
hub / github.com/marimo-team/marimo / set_ui_value

Method set_ui_value

marimo/_code_mode/_context.py:1800–1820  ·  view source on GitHub ↗

Queue a UI element value update. Triggers reactive re-execution the same way a user interaction would. Updates are flushed as a single batch on context exit. Examples: ```python slider = ctx.globals["my_slider"] ctx.set_ui_value(slider, 4

(self, element: Any, value: Any)

Source from the content-addressed store, hash-verified

1798 # ------------------------------------------------------------------
1799
1800 def set_ui_value(self, element: Any, value: Any) -> None:
1801 """Queue a UI element value update.
1802
1803 Triggers reactive re-execution the same way a user interaction
1804 would. Updates are flushed as a single batch on context exit.
1805
1806 Examples:
1807 ```python
1808 slider = ctx.globals["my_slider"]
1809 ctx.set_ui_value(slider, 42)
1810
1811 dropdown = ctx.globals["color_picker"]
1812 ctx.set_ui_value(dropdown, "red")
1813 ```
1814
1815 Args:
1816 element: A marimo UI element (e.g. `mo.ui.slider`).
1817 value: The new value, matching the type the element expects.
1818 """
1819 self._require_entered()
1820 self._ui_updates.append((UIElementId(element._id), value))
1821
1822 # ------------------------------------------------------------------
1823 # Low-level primitives

Callers

nothing calls this directly

Calls 2

_require_enteredMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected