Components
Every component in the kit, what it renders, and its props.
Each component is a file in components/loom/ after you install it. Most apps only render a thread or a layout; the pieces below are there when you want to compose your own.
Thread
The whole conversation: a header, the messages, what the agent is doing, errors, and the composer. It shares labels, answers and tool renderers with everything inside it.
<LoomThread
chat={chat}
title="Support"
empty={{
title: "How can I help?",
suggestions: ["Where is my order?", "Change my address"],
}}
tools={{ get_order: (call) => <OrderCard {...call.output} /> }}
/>
chatLoomChat
The conversation, from `useLoomEve` or any `LoomChat`.
LoomChattitle?ReactNode | false
Header title, such as an [agent picker](#agent-picker). `false` hides the header.
ReactNode | false"Assistant"actions?ReactNode
Extra header controls, before New conversation.
ReactNodeonClose?() => void
Shows a close button. The panel and widget set it.
() => voidempty?{ title?, description?, suggestions?, icon? }
The greeting and starter prompts on an empty conversation. Choosing a prompt sends it.
{ title?, description?, suggestions?, icon? }tools?Record<string, (call) => ReactNode | undefined>
Your own UI for tools, by name. See [tool cards](#tool-cards).
Record<string, (call) => ReactNode | undefined>labels?Partial<LoomLabels>
Replace any text the kit shows. See [labels](#labels).
Partial<LoomLabels>messageActions?{ retry?, edit?, feedback? }
What each message's actions menu offers besides Copy. See [message actions](#message-actions).
{ retry?, edit?, feedback? }composer?{ accept?, maxFileSize?, commands?, searchMentions?, voice?, placeholder?, autoFocus? }
Passed to the [composer](#composer).
{ accept?, maxFileSize?, commands?, searchMentions?, voice?, placeholder?, autoFocus? }commandShortcut?string
Opens the [command palette](#command-palette), like `"mod+k"`. The palette is offered when there are commands.
stringinputRef?Ref<HTMLTextAreaElement>
The composer's text box, to focus it.
Ref<HTMLTextAreaElement>className?string
stringMessages
LoomMessageList scrolls the conversation. It follows new content while the reader is at the bottom, even as a reply streams; once they scroll up it stays put and offers a button back to the latest. Sending a message always returns to the bottom.
LoomMessageView renders one message. The person’s text is a bubble; the agent’s reply is full width, with its parts in the order they came:
| Part | Renders as |
|---|---|
text |
Markdown through Streamdown, safe while it streams |
reasoning |
A collapsed “Thought” you can open; “Thinking” while it streams |
file |
An image, or a link to the file |
tool |
A tool card |
interaction |
An interaction card |
<LoomMessageList messages={chat.messages} empty={<p>Say hello</p>} />
The conversation is one stop in the Tab order. Inside it, ↑ and ↓ move between messages, Home and End jump to the first and last, and Enter opens the focused message’s actions. Keys pressed in a message’s own controls, such as a question’s options, stay with those controls.
Message actions
Each finished message has an actions menu, shown on hover or focus. Copy is always there. The rest show when you pass them to the thread, or to LoomProvider when you compose your own:
<LoomThread
chat={chat}
messageActions={{
retry: (message) => chat.send(lastUserText(message)),
feedback: (message, rating) => track("reply_rated", { id: message.id, rating }),
}}
/>
| Action | On | Does |
|---|---|---|
retry |
the agent’s replies | Your function, e.g. send the question again |
edit |
the person’s messages | The thread loads the message into the composer. Pass your own, or edit: undefined to hide it |
feedback |
the agent’s replies | Good or bad reply, checked in the menu once chosen |
Tool cards
LoomToolCard shows a call the agent made: its label, its state, its input as the model writes it, and its result or error with eve’s hint. An approval for the call opens inside the card.
To show a tool your own way, give the thread a renderer for it. Return undefined to fall back to the card, for example while the call is still running:
<LoomThread
chat={chat}
tools={{
get_weather: (call) =>
call.state === "completed" ? <Forecast {...(call.output as Forecast)} /> : undefined,
}}
/>
Call states: streaming, requested, approval, running, blocked, completed, failed, rejected and cancelled. Calls a tool marks as hidden don’t render.
Interactions
LoomInteractionCard renders what the agent asks a person, and answers through the thread’s respond:
- Approval: the request’s options as buttons, such as Approve and Deny.
- Question: buttons for a few options, or a list with Submit when the request asks for a select or has more than three. Free-text answers when the request allows them.
- Sign-in: the device code to enter and a link to the provider.
Once settled, the card shows the outcome and the answer given. A kind the kit doesn’t know yet still renders from the prompt, options, free text and link that every request has.
Composer
LoomComposer is the message box.
- Enter sends; Shift+Enter starts a new line; ↑ in an empty box brings back the last message.
- Attach files with the button, by dropping them on the box, or by pasting. They are sent as file parts.
- While the agent works, a new message waits for the current turn. Stop cancels the turn.
/at the start of the message lists your slash commands, and@finds what can be mentioned. Arrow keys move through the suggestions, Enter or Tab picks one, and Escape closes the list.- The microphone button dictates into the box.
chatLoomChat
Uses `status`, `canCancel`, `send` and `cancel`.
LoomChataccept?string | false
File types the attach button offers, as for `<input accept>`. `false` turns attachments off.
string | false""maxFileSize?number
Largest file it takes, in bytes.
number10485760commands?LoomCommand[]
Slash commands. Without them, `/` is plain text.
LoomCommand[]searchMentions?(query, { signal }) => LoomMention[] | Promise
Finds what `@` can mention. Without it, `@` is plain text.
(query, { signal }) => LoomMention[] | Promisevoice?boolean | { transcribe }
Dictation with the browser's speech recognition, hidden where there is none. `{ transcribe }` records audio for your own speech-to-text instead. `false` hides it.
boolean | { transcribe }trueplaceholder?string
stringautoFocus?boolean
booleancontroller?LoomComposerController
From `createLoomComposerController()`: `setText` and `focus` from elsewhere.
LoomComposerControllerSlash commands and mentions
A command is sent to the agent with the message, unless it has run, which the app runs instead. Its arguments are asked for in order after it’s picked, with ghost text at the caret and suggestions from options.
<LoomComposer
chat={chat}
commands={[
{ name: "summarize", description: "Sum up the conversation" },
{ name: "tone", arguments: [{ name: "tone", required: true, options: ["friendly", "formal"] }] },
{ name: "clear", description: "Start over", run: () => chat.newSession() },
]}
searchMentions={async (query, { signal }) => {
const res = await fetch(`/api/people?q=${encodeURIComponent(query)}`, { signal });
return res.json(); // [{ id, label, description? }]
}}
/>
The message keeps the text as typed, such as /tone formal or @Ama Owusu. What was picked travels beside it as the turn’s clientContext, which eve shows the model for that turn only:
{
"command": { "name": "tone", "arguments": { "tone": "formal" } },
"mentions": [{ "id": "u_ama", "label": "Ama Owusu" }]
}
Only what’s still in the message is sent: a mention that was deleted before sending is left out.
Dictation
With voice on, the composer uses the browser’s speech recognition, which most Chromium browsers and Safari have. Pass transcribe to use your own speech-to-text everywhere: the composer records with the microphone and adds the text you return.
<LoomComposer
chat={chat}
voice={{
transcribe: async (audio) => {
const res = await fetch("/api/transcribe", { method: "POST", body: audio });
return (await res.json()).text;
},
}}
/>
Command palette
LoomCommandPalette lists every slash command in a searchable dialog, for people who don’t know what to type after /. The thread adds it, with a header button, whenever the composer has commands. commandShortcut opens it from the keyboard:
<LoomThread chat={chat} composer={{ commands }} commandShortcut="mod+k" />
Commands with run run at once. The rest, and any that ask for a required argument, are put in the composer as /name to finish there. On its own, share a controller with a trigger of your own:
const [palette] = useState(createLoomCommandPaletteController);
<LoomCommandPaletteTrigger controller={palette} shortcut="mod+k">Commands</LoomCommandPaletteTrigger>
<LoomCommandPalette commands={commands} controller={palette} onPick={(command) => composer.setText(`/${command.name} `)} />
Agent picker
LoomAgentPicker chooses which agent the thread talks to: a button with the current agent that opens a searchable list. Your app passes the agents in. Put it in the thread’s title:
const agents = [
{ id: "support", name: "Support", description: "Orders and refunds" },
{ id: "billing", name: "Billing", description: "Invoices and payments" },
];
const [agent, setAgent] = useState("support");
const chat = useLoomEve({ agent });
<LoomThread
chat={chat}
title={<LoomAgentPicker agents={agents} value={agent} onValueChange={setAgent} />}
/>
eve reads agent when a session starts, so give the thread a key={agent} to start a fresh conversation with the new agent.
Session list
LoomSessionList lists past conversations, grouped into Today, Yesterday, Previous 7 days and Older, with buttons for a new conversation and to delete one. The page layout shows it as its sidebar when you pass sessions.
sessions{ id, title, updatedAt }[]
`updatedAt` is a `Date`, a timestamp in ms, or an ISO string. Sorted newest first for you.
{ id, title, updatedAt }[]currentId?string
The conversation on screen, marked as current.
stringonSelect(id) => void
(id) => voidonNew?() => void
Shows the New conversation button.
() => voidonDelete?(id) => void
Shows a delete button on each row.
(id) => voideve’s client doesn’t list sessions, so the list comes from your own store. Save a conversation once its first message is accepted, using the session id from eve’s binding:
function Conversation({ saved, onStarted }) {
const chat = useLoomEve(saved ? { initialSession: { sessionId: saved.id, streamIndex: 0 }, resume: true } : {});
const sessionId = chat.agent.session?.sessionId;
const first = chat.messages.find((m) => m.role === "user");
useEffect(() => {
if (!saved && sessionId && first) onStarted({ id: sessionId, title: titleFrom(first), updatedAt: Date.now() });
}, [saved, sessionId, first]);
return <LoomThread chat={chat} />;
}
To switch conversations, remount the thread with the chosen session. streamIndex: 0 with resume replays it from the start, so its whole history shows:
const [sessions, setSessions] = useState(loadSessions);
const [current, setCurrent] = useState<string>();
<LoomSessionList
sessions={sessions}
currentId={current}
onSelect={setCurrent}
onNew={() => setCurrent(undefined)}
onDelete={(id) => setSessions((all) => all.filter((s) => s.id !== id))}
/>
<Conversation
key={current ?? "new"}
saved={sessions.find((s) => s.id === current)}
onStarted={(s) => (setSessions((all) => [s, ...all]), setCurrent(s.id))}
/>
Keep the list wherever suits your app: localStorage for a demo, or a table keyed by user on your server, written from an API route when a session starts.
Status
LoomActivityLinesays what the agent is doing: thinking, using a tool, or waiting on you. It renders nothing while idle.LoomErrorNoticeshows the latest error, with an optionalonRetryaction.LoomEmptyStateis the greeting and starter prompts.
Labels
Every text the kit shows can be replaced, to translate it or change its tone. Pass labels to a thread or layout, or wrap your own composition in LoomProvider:
<LoomThread
chat={chat}
labels={{
placeholder: "Pregunta lo que quieras…",
send: "Enviar",
approve: "Aprobar",
deny: "Rechazar",
}}
/>
See defaultLabels in lib/loom/context.tsx for the full list.

