Skip to main content

Show conditional content

Reveal part of a screen and decide whether it keeps its local state.

Before you start: Edit a value.

show evaluates a boolean expression. When false, the content leaves layout and accessibility while its instance stays alive.

Show retained content​

Type a draft, hide it, and show it again. The draft remains.

<Column state="{open:true}" class="p-4 gap-3">
<Button title="Show or hide" on-press="toggle open" />
<Column show="open" state="{draft:''}">
<TextField label="Retained draft" model="draft" />
</Column>
</Column>
Show retained content
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: Change the button title. Verify the draft still survives hiding.

Compare show and if​

if removes the instance when false. Fill both inputs, hide them, then show them: only the show draft survives.

<Column state="{open:true}" class="p-4 gap-3">
<Button title="Show or hide" on-press="toggle open" />
<Column show="open" state="{draft:''}">
<TextField label="Retained with show" model="draft" />
</Column>
<Column if="open" state="{draft:''}">
<TextField label="Recreated with if" model="draft" />
</Column>
</Column>
Compare show and if
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: Repeat the comparison. Use if when a fresh instance is intended; avoid adding both directives to one element.

Next: render a collection. Reference: show, if.