Skip to main content

Reuse a component

Define a small component and invoke it with two different props.

Before you start: Render a collection.

Component declares a name, prop signature, and one rendered root. UI groups definitions and exactly one rendered root invocation. Definitions do not render by themselves. A definition reads explicit props; it does not capture root data.

Pass different props​

The two greetings share a definition while receiving separate values. Literal props are strings; use bind-* for evaluated or typed values.

<UI>
<Component name="Greeting" props="name">
<Text bind-text="'Hello, ' + props.name" />
</Component>
<Column class="p-4 gap-3">
<Greeting name="Sam" />
<Greeting name="Jo" />
</Column>
</UI>
Reuse a definition
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Add a third greeting. Open Definitions.xml and change the shared prefix in the definition and watch all instances update.

Next: compose components. You can also use the prebuilt component library.