PrimitivesSimpleComposer
Simple Composer
A ready-made Composer with an input and send button.
SimpleComposer ships with a full API table, a copyable example, and accessibility notes.
tsx
Installation
Install the package once, then import SimpleComposer from its direct entry point or from the root.
bash
pnpm add @agent-ui/reacttsx
import { SimpleComposer } from "@agent-ui/react/composer";Tailwind CSS v4 users: add @source "../node_modules/@agent-ui/react/src" to the global stylesheet so the library utilities are generated.
Usage
The example below is the same code that renders the preview. Copy it, swap in your own handlers, and ship.
tsx
import { SimpleComposer } from "@agent-ui/react"; <SimpleComposer onSend={(text) => send(text)} placeholder="Ask anything..." />API reference
Every prop SimpleComposer accepts, its type, default, and behaviour.
| Name | Type | Default | Description |
|---|---|---|---|
| onSend | (text: string) => void | — | Called with the trimmed draft. |
| placeholder | string | "Type a message..." | Textarea placeholder. |
| disabled | boolean | false | Disables the input and send control. |
| className | string | — | Merged onto the Composer surface. |
Use it with the rest of the library
SimpleComposer composes with MessageList, ChatShell, useChat, and the provider compose blocks. Browse the full reference or see all components in the gallery.
3 lines · copy-ready