Compose Provider
Context provider that owns text, model, toggles, send, and disabled state for a stage.
ComposeProvider ships with a full API table, a copyable example, and accessibility notes.
Installation
Install the package once, then import ComposeProvider from its direct entry point or from the root.
pnpm add @agent-ui/reactimport { ComposeProvider } from "@agent-ui/react";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.
import { ComposeProvider, ComposeTextarea } from "@agent-ui/react"; <ComposeProvider models={models} onSend={send}> <ComposeTextarea aria-label="Message" placeholder="Ask anything" /></ComposeProvider>API reference
Every prop ComposeProvider accepts, its type, default, and behaviour.
| Name | Type | Default | Description |
|---|---|---|---|
| models | ComposeModelOption[] | [] | Model menu options with optional hints. |
| defaultModelId | string | — | Initially selected model. |
| initialToggles | Record<string, boolean> | {} | Initial tool toggle state. |
| disabled | boolean | false | Blocks typing and sending. |
| onSend | (text: string) => void | — | Called with trimmed text. |
| children | ReactNode | — | Stage content. |
ComposeProvider composes with MessageList, ChatShell, useChat, and the provider compose blocks. Browse the full reference or see all components in the gallery.
5 lines · copy-ready