Skip to main content

Frontend

@forge/react is a headless React package for turning Forge transport events into render-ready state. It does not impose a visual design or require one transport implementation.

Wrap your UI in ForgeProvider, then use hooks such as useRunSubscription, useConversation, useSendMessage, usePendingInteraction, useAnswerQuestion, and useDecideApproval. The subscription reducer folds ordered run events into parts and can resume from a sequence cursor. Localization helpers map stable status and error codes to your catalog.

import { ForgeProvider, useRunSubscription, useSendMessage } from "@forge/react";
import type { ForgeClient } from "@forge/react";

function Chat({ client }: { client: ForgeClient }) {
return <ForgeProvider client={client}><Thread /></ForgeProvider>;
}
function Thread() {
const { parts } = useRunSubscription({ runId: "run-1", conversationId: "conversation-1" });
const { send, sending } = useSendMessage({ conversationId: "conversation-1" });
return <button disabled={sending} onClick={() => void send("Hello")}>{parts.length} parts</button>;
}

Next: GraphQL, SSE and streaming, and the client API.

Use it when your application needs a chat UI, streaming state, durable approval and question states, or localized client messages. Start with the Frontend concept, then use the client package reference for setup and public exports.