In the .view.xml layer(com.top_logic.layout.view), there is currently no component for displaying different views based on a channel value. There is no <switch>/`<case>`/`<if>`, and no view element has a visible/`render-if` expression.
Goal
A new, generally reusable <switch> element that displays exactly one of several configured views based on an input channel value. Case differentiation is performed using one TL-Script Boolean expression per <case> (first match wins), optionally with a <default>.
{{{#!xml <switch input="selectedPart">
<case test="p -> $p != null && $p.instanceOf(tl.model:TLClass)">
<form input="selectedPart" withEditMode="true"><field attribute="name"/></form>
</case>
<default>
<form input="selectedPart" withEditMode="true"><field attribute="name"/></form>
</default>
</switch> }}}
Implementation
- New SwitchElement (@TagName("switch")) with <case test="…"> and optional <default>, based on ReactDeckPaneControl (displays exactly one child, lazy-loaded + cached).
- The first truthy test wins; otherwise, the <default> is displayed; otherwise, it is empty. Toggling occurs only when switching between matching cases; within a case, the content bound to the channel updates automatically. Cached cases retain their state (e.g., edit mode).
- Example wiring in the model editor (model-editor.view.xml): The details panel displays the TLClass case for a selected class; otherwise, it displays the default.
Spec and implementation plan: docs/superpowers/specs/2026-07-20-view-switch-element-design.md and docs/superpowers/plans/2026-07-20-view-switch-element.md, respectively .