showcase/shell-docs/src/content/reference/channels/functions/renderToIR.mdx
renderToIR(renderable) expands fragments and function components into an
array of intrinsic ChannelNode values.
function renderToIR(ui: Renderable): ChannelNode[];
type Renderable =
| string
| ChannelNode
| ChannelNode[]
| { raw: unknown };
import { Header, Message, renderToIR } from "@copilotkit/channels/ui";
const ir = renderToIR(
<Message>
<Header>Incident update</Header>
</Message>,
);
The runtime calls this automatically before binding callbacks and rendering a message. Use it directly for component tests or a custom adapter.
Strings—and numbers used as component children—become text nodes. false,
null, and undefined render nothing. Function components are evaluated
immediately, so keep them pure and free of provider side effects.
The { raw } escape hatch produces a provider-specific raw node. Managed
Slack can pass native blocks through; the Teams renderer skips unknown raw
content. It is not portable.