Skip to content
Version 2.32.0
↓ Get the launcher

ConditionalElement record

React-style conditional. Both subtrees are built once; the renderer SetActive-toggles them each refresh from When (no reconciliation). Else may be null. Fill = the active branch expands to fill leftover height in a fixed-size (Resizable) window (so e.g. a meter’s list scroll grows with the window). Default false — no effect in content-sized windows.

public record ConditionalElement : IEquatable<HudElement>
name description
ConditionalElement(…) React-style conditional. Both subtrees are built once; the renderer SetActive-toggles them each refresh from When (no reconciliation). Else may be null. Fill = the active branch expands to fill leftover height in a fixed-size (Resizable) window (so e.g. a meter’s list scroll grows with the window). Default false — no effect in content-sized windows.
ContentRevision { get; set; } KeepAlive only: a cheap revision of the data the branch shows (any int that changes when that data changes — a hash of a few states, a counter). Bindings of a parked branch are paused, so data that changes while it is hidden (e.g. game HUD pieces that only exist in the world) would otherwise all be re-pulled — rows rebuilt, bubbles re-measured — in the frame it is shown again. With this, a parked branch whose revision moved is refreshed in the background (bindings on, off-screen, measures budgeted) while its window is on screen, and a re-warm after the window was hidden runs its bindings too. Polled about twice a second while parked. Framework 2.30.0. Null (default) = re-pulled on show, unchanged. An init property (binary-compatible).
Else { get; set; }
Fill { get; set; }
KeepAlive { get; set; } Keep the branch ALIVE once built: when hidden it is parked (its own canvas switched off, moved out of the layout and off-screen, its bindings paused) instead of deactivated, so showing it again costs about a normal frame instead of a full re-enable + re-layout (a set of tabs switched by click). For a set of sibling Conditionals that share ONE fixed-size slot — put them alone in their own Column: the branch takes the slot’s size (Fill is implied) and does not report its own size to the window. Combine with Prebuild so every branch is built and laid out in the background (and re-warmed after the window was hidden). No Else, not inside a VirtualList slot (ignored there). Not for content with InputElement.AutoFocus or RowElement.ConstrainsWindowMinWidth. Framework 2.30.0. Default false = SetActive toggling, unchanged. An init property (binary-compatible); its name is [UiPerf] tabshow’s (via PrebuildName).
Prebuild { get; set; } Build the branch(es) not shown yet in the BACKGROUND after the window mounts (framework 2.30.0), a few ms per frame, and lay them out off-screen while the window is on screen — so the first show of a big branch (a settings tab) only re-activates it instead of building it in that frame. A branch shown before its background build finished is completed synchronously first (never shown half-built). Values stay live: bindings refresh on show as for any hidden branch. Ignored inside a variable-height VirtualList slot. Costs nothing once done (the built branch stays inactive while hidden). Default false = built lazily on first show, unchanged. An init property (binary-compatible).
PrebuildName { get; set; } Diagnostics name for Prebuild: [Hitch] buckets prebuild:<name> and the [Prebuild] summary log line (HITCH/diagnostics on). Null = an index-based name.
Then { get; set; }
When { get; set; }