Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-composer.json --yes

Composer

Pro

A box to write a message, a comment or a prompt in, with attachments and a send button, for a chat or a record's comments, for React and Tailwind CSS. Part of Goop Pro.

Write a prompt (the box grows), attach a file or two, and send with the button or Ctrl/Cmd+Enter. The answer streams in; while it does the send button is Stop, which ends it where it is. At the start of the toolbar, the mention button adds @Teodora and the code button wraps the words as code; turn them off with Own controls at the start. Turn on Modes for a row of Ask and Note over the box: a note tints the box, and the line under it says which you picked. Switch the frame (default, comment, reply, compact) or turn the box off. The answer is a timer with three sample replies; attached files are listed by name, never read or sent; Teodora is a sample teammate; a note is answered like a question, never kept.

When to use

  • A box to write a message, a comment or a prompt in, with attachments and a send button, for a chat or a record's comments.
  • Also called: message input or comment box.

Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Composer on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-composer.json --yes
PROMPT
Add the Goop Composer to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { Composer, ComposerHeader, ComposerEditor, ComposerToolbar, ComposerToolbarStart, ComposerActions, ComposerAttach, ComposerSubmit } from '@/components/ui/goop/composer';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';

<>
  <Composer onSubmit={send}>
    <ComposerEditor aria-label="Comment" placeholder="Leave a comment" />
    <ComposerToolbar>
      <ComposerToolbarStart>
        <IconButton variant="ghost" shape="pill" size="sm" aria-label="Mention someone" onClick={mention}>
          <IconButtonIcon icon="at" />
        </IconButton>
        <IconButton variant="ghost" shape="pill" size="sm" aria-label="Format as code" onClick={formatCode}>
          <IconButtonIcon icon="code" />
        </IconButton>
      </ComposerToolbarStart>
      <ComposerActions>
        <ComposerAttach aria-label="Attach files" onFilesChange={attach} />
        <ComposerSubmit aria-label="Send" streaming={replying} onStop={stop} />
      </ComposerActions>
    </ComposerToolbar>
  </Composer>
  <Composer
    variant="reply"
    aria-label="Reply to Rhys"
    modes={[
      { value: 'reply', label: 'Reply', placeholder: 'Write to Rhys…' },
      { value: 'note', label: 'Internal note', variant: 'note', placeholder: 'Only your team sees this…', submitLabel: 'Add note' },
    ]}
    onSubmit={send}
  >
    <ComposerEditor aria-label="Message" />
    <ComposerToolbar>
      <ComposerActions>
        <ComposerSubmit aria-label="Send reply" />
      </ComposerActions>
    </ComposerToolbar>
  </Composer>
</>
  • Fits: chat, inbox (their recipes).
  • height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.

API reference

  • Each option with its sentence: composer--options.md
  • State: mode (mode / defaultMode / onModeChange); drawn by data-state=off, data-state=open
Parts
PartWhat it is
ComposerHeaderThe row above the editor for your tabs; the editor is their one panel, named by its panelId
ComposerEditorThe growing text box people write in; name it with aria-label, and Cmd or Ctrl+Enter sends; its props: composer--editor.md
ComposerToolbarThe row of buttons under the editor
ComposerToolbarStartYour own controls at the toolbar's start (a mention, a format, a Saved replies menu, a mode menu), before its actions
ComposerActionsThe buttons at the toolbar's end
ComposerAttachThe paperclip button that opens the file chooser, in ComposerActions; onFilesChange gets the files; its props: composer--attach.md
ComposerSubmitThe send button, last in ComposerActions; while a reply streams it becomes the stop button; its props: composer--submit.md
  • data-slot values (to select a part by): composer, composer-actions, composer-content, composer-header, composer-input, composer-toolbar, composer-toolbar-start

ComposerAttach

The paperclip button that opens the file chooser, in ComposerActions; onFilesChange gets the files.

TSX
import { ComposerAttach } from '@/components/ui/goop/composer';

Options

  • onFilesChange?: (files: File[]) => void — Called with the chosen files, each time a choice is made (the same file chosen again too).
  • accept?: string — File types offered, as the input's accept; any if left out.
  • Also takes: type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean; aria-label: string; tooltip?: string | false; tooltipKeys?: readonly string[]; loading?: boolean = false; loadingLabel?: string = 'Loading'

ComposerEditor

The growing text box people write in; name it with aria-label, and Cmd or Ctrl+Enter sends.

TSX
import { ComposerEditor } from '@/components/ui/goop/composer';

Options

  • panelId?: string — The id of the editor's region as the ONE panel the header's tabs switch.
  • Also takes: value?: string; defaultValue?: string; onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void; name?: string; required?: boolean; disabled?: boolean; form?: string

Composer: every option

TSX
import { Composer } from '@/components/ui/goop/composer';

Options

  • variant?: 'default' | 'comment' | 'reply' | 'compact' — The frame: default (the default) the framed prompt, comment a hairline frame, reply a smaller frame, compact the tight one a floating window holds.
  • disabled?: boolean = false — Disables the editor, the attach button and the caller's toolbar controls, never the header's tabs; false by default.
  • modes?: readonly ComposerMode[] — The kinds of message this composer writes (a reply, a note): shown as a row of options over the editor, on its start edge; a variant: "note" mode tints the composer while chosen.
  • mode?: string — The chosen mode's value, controlled (with onModeChange).
  • defaultMode?: string — The mode chosen first, uncontrolled; the first of modes by default.
  • onModeChange?: (mode: string) => void — Called with a mode's value when the writer picks it.
  • modesLabel?: string = 'Message type' — The modes row's name for a screen reader; "Message type" by default.
  • Also takes: onSubmit?: (event: FormEvent) => void
  • State: mode (mode / defaultMode / onModeChange); drawn by data-state=off, data-state=open
  • Types: ComposerMode = { value: string; label: string; placeholder?: string; variant?: 'default' | 'note'; submitLabel?: string }

ComposerSubmit

The send button, last in ComposerActions; while a reply streams it becomes the stop button.

TSX
import { ComposerSubmit } from '@/components/ui/goop/composer';

Options

  • children?: ReactNode | undefined — The send's words: drawn in the comment frame, its name in the arrow frames; or leave them out for aria-label.
  • aria-label?: string — The send's name where it has no words (required then); the arrow frames draw none.
  • streaming?: boolean = false — A reply is streaming: the send is the stop, named stopLabel, calling onStop.
  • onStop?: () => void — Called by a press of the stop while a reply streams; the form is never sent by it.
  • stopLabel?: string = 'Stop' — The stop's name (and the comment frame's words) while a reply streams.
  • Also takes: onClick?: (event: MouseEvent) => void; disabled?: boolean

Keyboard

KeyWhat it does
ArrowLeft ArrowRightMove selection
Home EndFirst or last item

Accessibility

  • The native element answers the keyboard.
  • hover, active, focus-within: the browser's own (:hover, :active, :focus-within): write nothing

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
pressedthe attribute data-state=off
expandedthe attribute data-state=open
openthe attribute data-state=open
disabledthe prop disabled

Motion

  • The part sets its own motion: add no transition or animation of your own.
  • How the theme moves, and how to move your own parts the same way: Motion.

Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

goop.so/themes/trail/components/composer.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-composer.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.