ComponentsAgent patterns

Chat Input

The message box of a chat. Type @ to tag an agent, /to add a skill, or # to add a file. Markdown and shortcuts format text. The bar holds attach and mode menus, a project picker, a model picker, and send.

SourceRegistry JSON

Installation

pnpm dlx shadcn@latest add https://sprout.tulipfarm.ai/r/chat-input.json

Copies Chat Input and the components it uses (Attachment, Button, Command, Dropdown Menu, File Viewer, Hover Card, Input Group, Mention List, Model Selector, Popover, Rich Text Editor, and Tooltip) into your app, installs the packages, and adds the styles. Then import it from @/components/ui/chat-input. Needs Tailwind CSS 4 and a components.json from shadcn init.

Chat input

Chat input

Type @ for agents, / for skills, or # for files. ** makes bold, _ makes italic, and links and emails turn into links. + adds files, the sliders pick a mode, and the model sits by send. Starter prompts show under an empty box.

Nothing has been sent.

Integrations

Integrations

Type an app's name, such as Slack or ChatGPT, and it shows as a chip with its icon. Hover a chip, or put the caret in it and press Tab, to see or switch its account. HubSpot and Jira aren't connected yet. These chips take a brand color that reads in light and dark.

Nothing has been sent.

  • Claude#d97757
  • Slack#e01e5a
  • Gmail#ea4335
  • Google Docs#4285f4
  • Google Calendar#4285f4
  • Linear#5e6ad2
  • HubSpot#ff7a59
  • Jira#0052cc

Neutral, since their brand color is black or too pale in one theme: ChatGPT, Google Drive, Google Sheets, Google Slides, GitHub, Notion.

With attachments

With attachments

Attached files show as chips above the message. Click one to view it, hover to peek, × removes it.

Nothing has been sent.

Working

Working

While a reply streams, send turns into stop and the placeholder says the agent is working.

Nothing has been sent.

Usage

Chat input usageTSX
import { ChatInput } from "@tulipfarm/sprout/chat-input";

<ChatInput
  value={value}
  onValueChange={setValue}
  onSend={send}
  onStop={stop}
  status={streaming ? "streaming" : "idle"}
  agents={(query) => searchAgents(query)}
  skills={(query) => searchSkills(query)}
  files={(query) => searchFiles(query)}
  attachments={attachments}
  onRemoveAttachment={remove}
  attachActions={[{ id: "computer", label: "Upload from computer", onSelect: pickFiles }]}
  modes={[
    { id: "plan", label: "Plan", color: "#3b9ef5" },
    { id: "research", label: "Deep research", color: "#6366f1" },
  ]}
  mode={mode}
  onModeChange={setMode}
  projects={projects}
  project={project}
  onProjectChange={setProject}
  models={[{ id: "opus", label: "Claude Opus 5.5", brand: "claude" }]}
  model={model}
  onModelChange={setModel}
  prompts={[{ id: "clarify", label: "Clarify user problem" }]}
  integrations={[
    {
      id: "slack",
      label: "Slack",
      icon: <BrandIcon brand="slack" size="inline" />,
      accounts: [{ id: "tf", label: "tulipfarm.slack.com" }, { id: "acme", label: "acme.slack.com" }],
      account: "tf",
    },
    { id: "hubspot", label: "HubSpot", icon: <BrandIcon brand="hubspot" size="inline" />, connected: false },
  ]}
  onConnectIntegration={(integration) => connect(integration.id)}
  onIntegrationAccountChange={(integration, accountId) => useAccount(integration.id, accountId)}
/>

value is a Tiptap JSON document. Tags arechatReference nodes with kind, id, andlabel. A trigger is on only when its source is set. A source may return a promise. Leave out a menu or picker and its button goes away. Give a mode a color (any CSS color) to tint the box border, the mode chip, and its menu icon while that mode is on.

integrations turns app names in the text into chips with their icon, such as Slack or ChatGPT. Give one a match list for aliases, a color tint, or connected: false to mute it with a broken-link mark and offer onConnectIntegration. Set account to show which account an app uses in its tooltip. With two or more accounts andonIntegrationAccountChange, the tooltip's Switch button opens a menu to pick another; return a promise to show a spinner until the switch finishes. The text stays plain; callfindKeywords(value, integrations) from @tulipfarm/sprout/rich-text-editor to know which apps a message uses. See the Rich Text Editor's keywords for matching rules.

A tag's chip shows its suggestion's media, and hovering or focusing it shows thedescription. Give a # file suggestion a file (name, media type, and source) and its chip previews CSV, TSV, text, and image files on hover and opens the File Viewer on click. A restored draft has tags that were never picked in this session; resolveReference looks those up and returns the same shape. Show the sent message withMessage Rich Text so it keeps the same chips.

Keyboard

Enter sends and Shift+Enter adds a line. In the panel, ↓ and ↑ move, Enter orTab adds, and Escape closes. ⌘B is bold,⌘I is italic, and ⌘K turns a selected URL or email into a link, or removes a link.