UI.Node
luastra/uiUI.Node is the host-neutral declarative value produced by every UI constructor. Nodes contain a validated component kind, stable ID, properties, and children that hosts translate into native semantic interface elements.
Mental model
This is a declarative node: app.render describes it again from current state, while the host matches its stable id to the existing view.
Before you use it
Add luastra/ui to this module's dependencies in luastra.json, then import it with require("luastra/ui"). The project must declare the ui.render capability. app.render must return one UI.Screen root; place this node inside that tree rather than invoking it for a hidden side effect.
How it fits
This type exists during Luau analysis and documents values used by UI constructors or app.render. It is erased from the runtime bundle as a static type.
When to use it
Use UI.Node as the return type of helpers that construct interface fragments and as the required return type of app.render. Application code should create nodes through UI constructors rather than assembling raw node tables.
Fields or definition
| Parameter | Type / values | Description |
|---|---|---|
| type | string | Checked type field of UI.Node; its exact admitted type is string. |
| id | string | Stable identifier used to correlate or address this value across operations. |
| properties | Properties | Checked properties field of UI.Node; its exact admitted type is Properties. |
| children | { Node } | Checked children field of UI.Node; its exact admitted type is { Node }. |
Children and layout
This component does not accept arbitrary child nodes; named parameters provide its content.
Accessibility and keyboard
A stable id, logical render-tree order, and visible labels preserve predictable keyboard and screen-reader navigation.
Common mistakes
- Using a duplicate id or an uppercase path segment.
- Passing a shared-group parameter that is not listed on this component page.
Returns
UI.Node — a declarative node in the new render tree.
What happens next
A checked annotation that matches the exact exported declaration.
Failures and fixes
If the annotation fails, compare the value with the exact declaration and the producing or consuming function.
Availability
Source API in 0.5.0-alpha; the public installer targets 0.5.0-alpha. Verify host-specific behavior against the selected SDK.
Exact declaration
export type Node = {
type: string,
id: string,
properties: Properties,
children: { Node },
}Continue with a complete recipe
This checked recipe uses UI.Node inside complete authored files with the required manifest, test, and run steps.
Open run a delayed action recipe