ComponentScope

@Stable
class ComponentScope(source)

What a component renderer sees: its properties resolved in its data scope, its children, two-way binding writes and action dispatch.

Properties

Link copied to clipboard
val component: JsonObject
Link copied to clipboard
Link copied to clipboard
val id: String
Link copied to clipboard

Functions

Link copied to clipboard
fun boolean(prop: String): Boolean?
Link copied to clipboard
fun child(prop: String = "child"): ChildRef?

The single child whose id is in prop (e.g. a Card's or Button's child).

Link copied to clipboard
fun children(prop: String = "children"): List<ChildRef>

The children in prop: a static id list or a template repeated over a data list.

Link copied to clipboard
fun dispatch(prop: String = "action")

Run the prop action: an agent event (sent with resolved context) or a local functionCall.

Link copied to clipboard
fun failedChecks(prop: String = "checks"): List<String>

Messages of the failing checks (A2UI Checkable); empty when valid.

Link copied to clipboard
fun number(prop: String): Double?
Link copied to clipboard
fun raw(prop: String): JsonElement?
Link copied to clipboard
fun ref(id: String, scope: DataContext = context): ChildRef?

A child referenced by id somewhere else in the properties (e.g. a tab's child).

Link copied to clipboard
@Composable
fun Render(child: ChildRef?, modifier: Modifier = Modifier)
Link copied to clipboard
fun resolve(prop: String): JsonElement?
Link copied to clipboard
fun string(prop: String): String?
Link copied to clipboard
Link copied to clipboard
fun write(prop: String, value: JsonElement?)

Two-way binding: store value where prop is bound (literal properties are read-only).