Props
| Prop | Type | Default | Description |
|---|---|---|---|
if | boolean | (required) | Condition. true executes then; false executes else. |
then | ReactElement | (required) | Element to render when true. |
else | ReactElement | undefined | Element to render when false. If omitted, nothing executes. |
skipIf | boolean | false | Skip the entire branch regardless of condition. Returns null. |
Basic usage
Without an else branch
Complex sub-graphs
Each branch accepts any workflow element. Wrap multiple elements in<Sequence> or <Parallel>:
Conditional skipping
Condition evaluation
Theif prop is evaluated at render time. Smithers re-renders the tree each frame, so conditions can depend on outputs of completed tasks:
ctx.outputMaybe() when the upstream task may not have completed yet.
Rendering
<Branch> renders the selected child wrapped in a <smithers:branch> host element. Only the selected branch’s tasks are mounted. The other branch is absent from the task graph.
Notes
- Only one branch executes per render frame.
thenandelseeach accept a singleReactElement. Wrap multiple elements in<Sequence>or<Parallel>.- Conditions are re-evaluated each render frame, enabling data-dependent control flow.