`value` property on UIElements is documented as writable but raises RuntimeError when set
Documentation is
- [ ] Missing
- [ ] Outdated
- [x] Confusing
- [ ] Not sure?
Explain in Detail
The API documentation for UI elements such as mo.ui.text marks the value atrribute as writable, which implies it can be set directly. However, attempting to do so raises a RuntimeError:
import marimo as mo
x = mo.ui.text(label="textfield")
x.value = "hello"
# RuntimeError: Setting the value of a UIElement is not allowed.
# If you need to imperatively set the value of a UIElement, consider using mo.state().
Marimo version 0.20.4
Your Suggestion for Changes
Either: The value property should be settable as documented, or The documentation should be updated to remove the "writable" label and clarify that direct assignment is not supported.
Will you submit a PR?
- [ ] Yes
Sidenote
I know you can set the value of a text element at initialization.
This was just a simple example.
But I am in fact struggling with setting a default value for a file_browser
Edit: never mind, this seems to be an open feature request #7468
Looking into this — I’m checking where the docs imply is writable versus where the runtime intentionally rejects assignment, so I can tighten the docs to match actual behavior.