Skip to content

value property on UIElements is documented as writable but raises RuntimeError when set #9203

@Lucas-vdr-Horst

Description

@Lucas-vdr-Horst

Documentation is

  • Missing
  • Outdated
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions