---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Composer

A box to write a prompt, a comment, a reply or an email in, with attachments and a send button, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `Composer`.

## Try it

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 prompt, a comment, a reply or an email in, with attachments and a send button.
- 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.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-composer.json --yes
```

```text
Add the Goop Composer to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import {
  ComposerHeader, ComposerHeaderMark, ComposerHeaderTitle, ComposerHeaderActions, ComposerClose, ComposerFields, ComposerField, ComposerFieldInput, ComposerFieldTrigger,
} from '@/components/ui/goop/composer';

import { useState } from 'react';
import {
  Composer,
  ComposerActions,
  ComposerAttach,
  ComposerButton,
  ComposerEditor,
  ComposerSubmit,
  ComposerToolbar,
  ComposerToolbarStart,
} from '@/components/ui/goop/composer';

function AskTheLog({ onAsk, onAttach }: { onAsk: (question: string) => void; onAttach: (files: File[]) => void }) {
  const [question, setQuestion] = useState('');
  return (
    <Composer
      aria-label="Ask the log"
      onSubmit={(event) => {
        event.preventDefault();
        onAsk(question);
        setQuestion('');
      }}
    >
      <ComposerEditor
        aria-label="Question"
        placeholder="Ask about a field note…"
        value={question}
        onChange={(event) => setQuestion(event.currentTarget.value)}
      />
      <ComposerToolbar>
        <ComposerToolbarStart>
          <ComposerButton icon="at-sign" aria-label="Mention someone" />
        </ComposerToolbarStart>
        <ComposerActions>
          <ComposerAttach aria-label="Attach files" onFilesChange={onAttach} />
          <ComposerSubmit aria-label="Send" disabled={!question.trim()} />
        </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

### Parts

- `ComposerHeader` — The row above the editor
- `ComposerHeaderMark` — The header's mark; its props: composer--header-mark.md
- `ComposerHeaderTitle` — The header's title
- `ComposerHeaderActions` — The header's actions at its end, 12 px apart
- `ComposerClose` — The close cross at the header's end; its props: composer--close.md
- `ComposerFields` — The email frame's field rows (To, From, Subject), each a `ComposerField`, over the message
- `ComposerField` — One field row; its props: composer--field.md
- `ComposerFieldInput` — A field row's text box (To, Subject); its props: composer--field-input.md
- `ComposerFieldTrigger` — A field row's quiet picker trigger (From); its props: composer--field-trigger.md
- `ComposerEditor` — The growing text box people write in; name it with aria-label, and Cmd or Ctrl+Enter sends; its props: composer--editor.md
- `ComposerToolbar` — The row of buttons
- `ComposerToolbarStart` — Your own controls at the toolbar's start (a mention, a format, a Saved replies menu), before its actions
- `ComposerActions` — The buttons at the toolbar's end
- `ComposerButton` — A quiet round icon button sized for its frame, for your own controls in `ComposerToolbarStart` (a mention, a format) or `ComposerActions`; its props: composer--button.md
- `ComposerAttach` — The paperclip button that opens the file chooser, in ComposerActions; onFilesChange gets the files; its props: composer--attach.md
- `ComposerSubmit` — The send button, last in ComposerActions (in the email frame, first in ComposerHeaderActions); while a reply streams it becomes the stop button; its props: composer--submit.md

### 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.
- children?: ReactNode — With `asChild`: the one element that becomes the button, the paperclip drawn in it.
- Also takes: asChild?: boolean; 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'

### ComposerButton

A quiet round icon button sized for its frame, for your own controls in `ComposerToolbarStart` (a mention, a format) or `ComposerActions`.

```tsx
import { ComposerButton } from '@/components/ui/goop/composer';
```

### Options

- icon: IconName — The pack icon's name.
- aria-label: string — The button's name: it has no words.
- Also takes: type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean

### ComposerClose

The close cross at the header's end.

```tsx
import { ComposerClose } from '@/components/ui/goop/composer';
```

### Options

- aria-label?: string = 'Close' — The cross's name; "Close" by default.
- Also takes: onClick?: (event: MouseEvent) => void; disabled?: boolean; 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.
- variant?: 'default' | 'unstyled' | 'dialog' = 'unstyled' — The theme's Textarea look the editor wears: `unstyled` the composer's own bare line, `default` the filled field, `dialog` the notes line.
- Also takes: value?: string; defaultValue?: string; onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void; name?: string; required?: boolean; disabled?: boolean; form?: string

### ComposerFieldInput

A field row's text box (To, Subject).

```tsx
import { ComposerFieldInput } from '@/components/ui/goop/composer';
```

### Options

- Also takes: value?: string; defaultValue?: string; onChange?: (event: ChangeEvent<HTMLInputElement>) => void; name?: string; required?: boolean; disabled?: boolean; form?: string

### ComposerFieldTrigger

A field row's quiet picker trigger (From).

```tsx
import { ComposerFieldTrigger } from '@/components/ui/goop/composer';
```

### Options

- Also takes: type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean

### ComposerField

One field row.

```tsx
import { ComposerField } from '@/components/ui/goop/composer';
```

### Options

- label: ReactNode — The row's label ("To", "From", "Subject").
- htmlFor?: string — The id of the control the label names; one is made for the row's own parts when left out.
- children: ReactNode — The row's control.

### ComposerHeaderMark

The header's mark.

```tsx
import { ComposerHeaderMark } from '@/components/ui/goop/composer';
```

### Options

- icon?: IconName — The pack icon's name on the tile; `mail` by default.

### Composer: every option

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

### Options

- variant?: 'default' | 'comment' | 'reply' | 'compact' | 'email' | 'filled' — The frame: `default` (the default) the prompt bar, `comment` a hairline frame, `reply` a smaller frame, `compact` the tight one a floating window holds, `email` the email panel (a header, field rows, the message), `filled` the grey message box with its worded Send inside it.
- disabled?: boolean = false — Disables the editor, the fields, the attach button, the send and the caller's toolbar controls; 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-focus-visible, 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 (in the email frame, first in ComposerHeaderActions); 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 and email frames, its name in the arrow frames.
- 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 worded frames' words) while a reply streams.
- Also takes: onClick?: (event: MouseEvent) => void; disabled?: boolean

## Accessibility

- The native element answers the keyboard.
- hover, active, focus-within: the browser's own (:hover, :active, :focus-within): write nothing
- focus-visible: the attribute data-focus-visible
- pressed: the attribute data-state=off
- expanded: the attribute data-state=open
- open: the attribute data-state=open
- disabled: the prop disabled

## Motion

- The part sets its own motion: add no transition or animation of your own.

## 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.

Shortened to fit: the data-slot values.

## Related

- [Attachment list](/themes/meadow/components/attachment-list): The files chosen to send, under a composer or a form field.
- [Message list](/themes/meadow/components/message-list): The messages of one conversation in a column, the newest at one end, as they arrive.
- [Chat message](/themes/meadow/components/chat-message): One message of a conversation: its author, its body and when it was sent, often an avatar and actions.
