.wf/components-*.jsonl
..wf/components-*.jsonl
.init_ui()
method sets up a UI manager to configure UI components at the application’s startup. This creates a component set that is accessible across all sessions:
ui
parameter is used within handler functions. This approach allows for real-time modifications tailored to individual user sessions:
find
methodui.find(component_id: str)
method to access existing components by ID:
RuntimeError
.
refresh_with
methodui.refresh_with(component_id: str)
method to replace children CMCs of an existing component (referenced by its ID):
find
method, it also raises a RuntimeError
if it fails to find a referenced component.
parent
methodui.parent(component_id: str, level: int = 1)
gives access to the id to parents at higher levels.
ui.Text
method, which is used for creating Text components.
This method expects content: dict
as first argument, which enables you to set the field properties of the component, through corresponding keys:
content
as its first argument:
content
, a set of fields which is specific to the component type, you can also modify the base properties of the component itself, which are:
id: str
: A unique identifier used for accessing the component after it was created.RuntimeWarning
and the existing component being overwritten with a newly created one.
id
if you intend to find
the component laterfind
method relies on id
of the component, retrieval might get tricky if its id
was generated randomly.position: int
: Determines the display order of the component in relation to its siblings.0
means that the component is the first child of its parent.-2
is used for components – such as sidebars – that have a specific reserved position not related to their siblings.
parentId: str
: Determines the parent container for the component. By default, components recognise the container in the context of which they were defined as their parent. This allows for linking components to their parents outside of context, or for overriding a parent within a context.
visible: bool | str
: Determines the visibility of the component, True
by default.
handlers: dict[str, callable]
: Attaches event handlers to the component. Each dictionary key represents an event, and its value is the corresponding handler.:
binding: dict[str, str]
: Links the component to a state variable via binding. The dictionary key is the bindable event, and the value is the state variable’s name:
binding
dictionary includes multiple event-variable pairs, a RuntimeError
will be triggered.with
keyword to define such layouts:
UIError
.with
are being appended to it:
refresh_with
method: