Slot reserves a named place in your layout for that dynamic content.
Slot watches a state key. When that key holds a component tree (a JSON object with a type field), Slot renders it. When the key is empty, Slot renders its children as fallback content — or nothing at all.
Basic Usage
Pass the state key name as the first argument. Here,info holds a Card component tree in state:
The layout defines where the dynamic content goes. The state (or an action that populates it) determines what appears there. In practice, the state key is often populated by a CallTool or API action with result_key — the action fetches a component tree and writes it into state, and the Slot picks it up automatically.
Fallback Content
Nest children insideSlot to define what shows when the state key is empty. Toggle the switch to see the transition — the ternary expression pulls the detail_card component tree from state when on, or null when off.
Since the fallback is a regular component tree, you can make it as rich as you need — icons, buttons, styled containers. Once state["selected_item"] gets a component tree, the fallback disappears and the slot content takes over.
API Reference
Protocol Reference
Slot