Condition
Renders a different set of blocks depending on the client surface that's viewing them.
condition picks one branch of blocks to render based on client conditions, and falls back to
default when none match. It’s a library-invented construct for previewing client-conditional
payloads; Slack doesn’t document a public condition block type.
Since this renderer only ever simulates Slack’s desktop client, the example above always shows the desktop branch, the same way it would look in Slack’s own Builder preview.
Fields
typestring
Always `condition`.
stringcases?{ conditions: ConditionClause[]; blocks: Block[] }[]
Branches, tested in order. The first case whose conditions all match wins, and its `blocks` render.
{ conditions: ConditionClause[]; blocks: Block[] }[]default?Block[]
Blocks rendered when no case matches.
Block[]ConditionClause
typestring
The condition kind. Only `"client"` is evaluated; any other value never matches.
stringop?"=" | "!="
Comparison against `value`. Omitted is treated the same as `"="`.
"=" | "!=""="value?string
The client to compare against, e.g. `"desktop"`, `"ios"`, `"android"`.
stringExamples
Client branches with a default
The preview above defines a branch per client plus a default, and only the desktop branch renders.
Negated condition
op: "!=" matches every client except the given value. Here the desktop client never matches, so
the default branch renders instead.