Agent Composer
agent-composerThe compact composer of an agent app: a rounded field with round controls flush inside, send that becomes stop in place, a light that runs round the edge while the agent works, and a status row beneath.
"use client";
import { MessagesSquare, Sparkles } from "lucide-react";
import { useEffect, useState } from "react";
import { AgentComposer } from "@/components/forme/blocks/agent-composer/agent-composer";
export function AgentComposerDemo() {
const [busy, setBusy] = useState(false);
const [sent, setSent] = useState(0);
// A stand-in for a reply: it finishes on its own after a few seconds.
useEffect(() => {
if (!busy) return;
const timer = setTimeout(() => setBusy(false), 4000);
return () => clearTimeout(timer);
}, [busy]);
return (
<div className="w-full max-w-xl">
<AgentComposer
busy={busy}
onSubmit={() => {
setSent((count) => count + 2);
setBusy(true);
}}
onStop={() => setBusy(false)}
controls={
<span className="hidden items-center gap-1 px-2 text-body-2-medium text-muted-foreground sm:flex">
<Sparkles aria-hidden className="size-3.5" />
Forge 1
</span>
}
status={
<>
<span className="flex items-center gap-1.5">
<span aria-hidden className="size-1.5 rounded-full bg-success" />
Connected
</span>
<span className="flex items-center gap-1.5 tnum">
<MessagesSquare aria-hidden />
{sent === 0 ? "New chat" : `${sent} messages`}
</span>
</>
}
/>
</div>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
AgentComposer
The composer of an agent app: one rounded field with round controls flush inside it, and a status row beneath.
| Prop | Type | Default | Description |
|---|---|---|---|
onSubmit* | (message: { text: string; files: File[] }) => void | — | Called with the text and any attached files. The field clears itself. |
busy | boolean | false | While true, send becomes stop and a light runs round the edge. |
onStop | () => void | — | |
placeholder | string | "Ask me anything" | |
label | string | "Message" | Accessible name for the field. |
attachments | boolean | true | Shows the paperclip. |
controls | ReactNode | — | Beside the send button: a model name, a model picker, a toggle. |
status | ReactNode | — | The quiet row under the composer: the model, the provider, a message count. |
disabled | boolean | — | |
className | string | — |
Related


Agent Image Chat
A chat that makes images: each prompt becomes a turn whose image holds its shape, ripples while it generates and sharpens in, with download, variations, stop and retry. Built from Message, MessageScroller, ImageGeneration and AgentComposer.
ai
ProPrompt Input
The composer for an agent: a field that grows, files by button, paste or drop with removable previews, a / menu of commands with full keyboard support, tool toggles sent with the message, and send that turns into stop.
ai
ProQueue
What is waiting while an agent works: messages you queued and the to-dos it has not reached, in collapsible sections joined to the top of the composer, each item with send-now and remove on hover or focus.
ai