Skip to content

Agent Composer

Coding agent prompt box with a model picker.

Usage

Usage
import { AgentComposer } from '@/components/ui/agent-composer'


<AgentComposer onSubmit={(prompt) => console.log(prompt)} />


// Your own providers and models
<AgentComposer
  placeholder="What should we build?"
  providers={[
    { id: 'anthropic', label: 'Anthropic', icon: <AnthropicIcon /> },
    { id: 'openai', label: 'OpenAI', icon: <OpenAIIcon /> },
  ]}
  models={[
    { value: 'Claude Opus 5.5', provider: 'anthropic' },
    { value: 'GPT-6 Sol', provider: 'openai' },
  ]}
  defaultModel="Claude Opus 5.5"
  defaultFavorites={['Claude Opus 5.5']}
  reasoningLevels={['Low', 'Medium', 'High']}
  defaultReasoning="Medium"
  modes={[{ id: 'fast', label: 'Fast' }]}
  onAction={(id) => openPanel(id)}
  onSubmit={(prompt, { model, reasoning, modes, files }) =>
    startTask({ prompt, model, reasoning, modes, files })
  }
/>

Install

pnpm dlx shadcn@latest add @pastaui-pro/agent-composer

Source

Props

Agent Composer props
PropTypeDefaultDescription
valuestring= —Controlled text value. Pair with onValueChange.
defaultValuestring= ''Initial text when uncontrolled.
onValueChange(value: string) => void= —Called with the new text on every change and after clearing on submit.
onSubmit(value: string, options: { model?: string; reasoning?: string; modes: string[]; files: File[] }) => void= —Called on Enter or the send button when the text is not empty, with every current selection. Shift+Enter inserts a new line and Enter does nothing during IME composition.
placeholderstring= 'Describe a task, / for commands, @ to add context'Placeholder text.
labelstring= 'Message'Accessible label for the text field.
clearOnSubmitboolean= trueClear the text and attachments after submitting.
providers{ id: string; label: string; icon?: ReactNode }[]= OpenAI, Anthropic, Google (with logos)Filters in the model picker rail, after Favorites. Left and Right arrow keys switch filters while the menu is open.
models{ value: string; label?: string; provider: string }[]= Sample modelsOptions for the model picker. provider should match a provider id. Pass [] to hide the picker.
defaultModelstring= 'Claude Opus 5.5'Initially selected model value. Falls back to the first model.
onModelChange(value: string) => void= —Called when a model is picked.
defaultFavoritesstring[]= Five sample modelsModel values starred at first. Hover a row and click the star to toggle.
onFavoritesChange(favorites: string[]) => void= —Called with the new favorites list after a star is toggled.
reasoningLevelsstring[]= ['None', 'Low', 'Medium', 'High', 'Extra high', 'Max']Options in the reasoning menu. The selected one is the trigger label.
defaultReasoningstring= 'High'Initially selected reasoning level. Falls back to the first level.
onReasoningChange(value: string) => void= —Called when a reasoning level is picked.
modes{ id: string; label: string; icon?: ReactNode }[]= Fast, ProSwitch rows under the reasoning levels. Pass [] to hide the Modes section.
defaultModesstring[]= []Mode ids that start switched on.
onModesChange(modes: string[]) => void= —Called with the ids of every mode that is on after a switch changes.
showAttachboolean= trueShow "Upload attachment" in the paperclip menu. Picked files appear as removable chips and are passed to onSubmit.
attachActions{ id: string; label: string; icon?: ReactNode }[]= Environment variablesExtra rows under "Upload attachment" in the paperclip menu.
contextActions{ id: string; label: string; icon?: ReactNode }[]= Files, Pull requests, Threads, SkillsThe second group in the paperclip menu.
onAttach(files: File[]) => void= —Called with newly picked files.
onAction(id: string) => void= —Called with the id of an attach or context action row.
disabledboolean= falseDisables the text field, every picker, and sending.
containerClassNamestring= —Additional classes for the outer wrapper. Max width is 712px by default.
classNamestring= —Additional classes for the textarea. Other native textarea props and ref are forwarded to it.