Skip to content

Agent Composer

Premium

The message input an agent sits behind: a textarea that grows to six rows, inline slash commands, @file mentions as removable chips, a drag-and-drop attachment row, a model picker with each provider's logo, and a round send button whose glyph becomes a pulsing stop square while the agent works.

AI Agent UIAI coding agentsChat assistantsInternal tools
2 files in context · 1.2k tokens
app/lib/component-registry.tsx
Plan
hero-frame.png
2 files in context · 1.2k tokens

Examples

Draft and send
No files in context
No files in context
Working state
Agent is working. Press Escape to stop.
No files in context

Add to your projectPremium component

One command adds this component to your project.

1

Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.

npx shadcn@latest add @aicanvas/••••••••••••
2

For dark mode, add the dark class to your <html> element:

Optional
<html class="dark">

Install with AI Canvas MCP

With AI Canvas MCP, your AI knows every component we ship. Ask for one inside Claude Code, Codex, or Cursor and it installs the component you pick. Works with any AI Canvas account, free or premium.

Props

Every prop this component accepts. Any other prop is forwarded to the underlying element.

CommandItem

PropTypeDefaultDescription
idreqstring-Stable command identifier that must be unique within the commands list.
labelreqstring-Command name shown in the picker and selected chip.
hintreqstring-Supporting text shown beside the command name in the picker.
iconIconType-Icon shown for the command; left out, the picker uses its generic command mark.

FileItem

PropTypeDefaultDescription
pathreqstring-File path shown in mention results and inserted into the context list.
kbreqnumber-File size in kilobytes used to estimate the context token count.

ModelItem

PropTypeDefaultDescription
idreqstring-Stable model identifier that must be unique within the models list.
labelreqstring-Model name shown on the selector and in its menu.
speedreqstring-Speed description shown in the model menu.
costreqstring-Cost description shown in the model menu when space allows.
markModelMark-Mark drawn beside the model; left out, a generic circular mark is used.

AgentComposer

PropTypeDefaultDescription
valuestring-Controls the message text; left out, text is kept internally, while passing it turns the demo off.
onChange(value: string) => void-Receives each text edit; left out, uncontrolled text still updates locally but a controlled value cannot change.
onSend(payload: SendPayload) => void-Receives the trimmed text, selected command, mentions and attachments; left out, submission only clears the local composition, while passing it turns the demo off.
onStop() => void-Handles stopping a busy request and makes the stop control available outside the demo; left out, a host-controlled busy state has no stop control.
busyboolean-Controls whether the composer shows its working state; left out, that state is managed internally, while passing it turns the demo off.
commandsCommandItem[]-Supplies slash commands; left out, the demo uses sample commands and host mode uses none, while passing it turns the demo off.
filesFileItem[]-Supplies files for mentions and attachments; left out, the demo uses sample files and host mode uses none, while passing it turns the demo off.
modelsModelItem[]-Supplies the model selector options; left out, the demo uses sample models and host mode uses none, while passing it turns the demo off.
modelstring-Controls the selected model by id; left out, the first available model is selected internally, while passing it turns the demo off.
onModelChange(id: string) => void-Receives a selected model id; left out, model selection is kept internally when model is uncontrolled.
placeholderstring-Sets the empty text prompt; left out, it is assembled from the available command and file shortcuts.
submitModeSubmitMode'enter'Chooses whether Enter, modified Enter or no keyboard shortcut sends the message.
maxRowsnumber-Sets the textarea height limit in text rows; left out, the tuning height limit is used.
classNamestring-Adds classes to the outermost root; left out, only the built-in classes are used.
tuningPartial<Tuning>-Overrides composer measurements and motion values; left out, every value in TUNING is used.

About Agent Composer

Agent Composer is the message input for an agent: a growing textarea with slash commands, file mentions, attachments and a model chip, and a send button that turns into stop while the agent works. Typing a slash opens an inline command list that becomes a chip, an at sign opens recent files and the footer counts the context they add, dropped files sit in a row above the input, and Escape stops a running turn while queued text waits with a chip. Every list is a real listbox with full keyboard control, and the whole thing is typed props with sensible defaults.

Built with

MotionTailwind CSS

Frequently asked questions

Is Agent Composer free to use?
Agent Composer is a Premium AI Canvas component. Premium unlocks the full source code, the full remix prompt, and one-command installs for every Premium component, block, and template.
How do I install Agent Composer?
Premium unlocks one-command installs: run the shadcn CLI with your AI Canvas token, or connect the AI Canvas MCP server and ask your AI editor to install it for you. Premium also unlocks the full remix prompt in the Remix panel.
What is Agent Composer built with?
Agent Composer is built with React and TypeScript, using Motion and Tailwind CSS. It ships with both light and dark styling.
Where would I use Agent Composer?
Common uses include AI coding agents, Chat assistants, and Internal tools. Like every AI Canvas component, it is self-contained and drops into any React project.
Can I remix Agent Composer with AI?
Yes. Open "Remix with AI" on this page to read the setup and the constants Agent Composer is built from. The engine, the markup and the notes on how it works are part of Premium. For the exact component, install it with the one-command CLI.

Featured in collections

More like this