# Composer: writing next to a record

Composer is the one box an app built on Meadowstack uses for writing next to a record or in a conversation, with the send button inside it. Cmd or Ctrl+Enter sends, the text stays in the box if sending fails, and what was sent appears in the record's history as a filled bubble.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/components/composer/

*Brightpath's task BRI-106 in the demo: the last two comments of its activity and the comment box, empty; right, a reply typed in, which brings the key cap beside the send button. The reply is an example.*

A live screen, rendered from the kit's components on the page: https://meadowstack.com/components/composer/

## What it is for

People ask about a record next to the record: "Is this the final quantity?", "I will send the change in Figma." In an app built on Meadowstack that box is always `Composer`: one rounded box with the send button inside, under the record's history, labelled by the `Field` around it. What was sent lands in the history as a filled bubble, so the question and the changes it is about read as one story.

The preview is the end of a task panel in the [Brightpath example](https://meadowstack.com/examples/agency-capacity-planning/): two comments from the activity, then the box. On the left it is empty and shows its placeholder; on the right a reply is typed and the key cap for the shortcut appears beside the send button. The box grows with the text, up to ten lines, and then scrolls inside.

The manifest sets its range: writing next to a record or in a conversation, and the assistant's box with `appearance="liquid"`. A form's field is an `Input` or `Textarea` in a `Field`, and a long post with formatting is `RichTextEditor`.

## The rules and where they live

- **Writing next to a record is Composer in a Field: the send button inside, Cmd/Ctrl+Enter sends, written text in AuditTimeline a filled bubble.** The root `AGENTS.md`, Look and feel.
- **Every input has a visible label.** `AGENTS.md`, Accessibility (WCAG 2.2 AA): the `Field` gives the box its label, the placeholder only hints.
- **Shortcuts are chords, never a single character.** `AGENTS.md` and `docs/principles.md` (WCAG 2.1.4): sending is Cmd or Ctrl with Enter, so plain Enter is a new line in a comment.
- **One box to write in, mentions with @, files, Cmd/Ctrl+Enter or Enter in chat.** `docs/patterns.md`, Conversation, where the same box runs the chat, the comments and the inbox.
- **The composer is as wide as the messages.** `docs/principles.md`, Conversations: text keeps a reading measure, and the box lines up with it.
- **No own textarea in an app.** The static guard `bare-control` in `scripts/check-markup.mjs` fails an app's own `textarea` or `button` (`docs/audit.md`), which leads to the kit's box.

## What AI coding tools write instead

The manifest names two: **a textarea above a row of buttons** and **a hand-built chat input**. The first puts a grey "Post comment" button under a bare textarea, often with no label but its placeholder. Enter sends half-written comments, or nothing sends from the keyboard at all. The text is cleared as the request leaves, so a failed send loses it. And the comments end up in a list of their own, apart from the record's history.

`Composer` keeps the text until `onSend` succeeds and shows a spinner in the button meanwhile; the demo's task panel adds a toast saying the comment could not be sent and the text is still in the box. Sending is a chord with a visible key cap, the `Field` brings the label, and the comment becomes an entry in [AuditTimeline](https://meadowstack.com/components/audit-timeline/) like any other change.

## How to use it

| Prop | What it takes |
| --- | --- |
| `value`, `onValueChange` | The text, controlled by you. |
| `onSend` | Gets the text; the button spins until it settles, and the text stays if it throws. |
| `submitOn` | `"mod+enter"` (the default, for comments) or `"enter"` (for a chat). |
| `mentions` | The app's records to offer after @. |
| `sendLabel`, `allowEmpty`, `emptyAction` | The button's name, sending without text, and what the empty box offers instead. |
| `leading`, `top` | Slots before the text and above it, such as an attachment. |
| `layout`, `appearance` | `"inline"` or `"stacked"`; `"box"` or `"liquid"` for the assistant. |

Wrap it in a `Field` with the label people see, and put it right under the record's history.

## Its entry in the manifest

*The component's rules as the kit's manifest states them, the same entry an AI coding tool reads.*

| Manifest field | Composer |
| --- | --- |
| What it is | One box for writing a comment, note or message, with the send button inside; Cmd/Ctrl+Enter sends. |
| Use it for | Writing next to a record or in a conversation; appearance="liquid" for the assistant. |
| Not for | For a form field (Input or Textarea in a Field); For a long post with formatting (RichTextEditor) |
| It replaces | A textarea above a row of buttons; A hand-built chat input |
| Screen types | Record; Inbox; Worklist; Workspace |
| Import | `import { Composer } from "@meadowstack-studio/kit";` |

Read from the kit's component manifest when the site was built (126 components, packages/kit/src/components.json); the same entry answers an AI coding tool through the kit's MCP server.

## Where the example apps use it

*The example apps and modules that render Composer, read from the demo's code when the site builds.*

| Example app | Modules that render it |
| --- | --- |
| [An app for a packaging and print company](https://meadowstack.com/examples/packaging-print-production/) | Jobs, Print file editor |
| [An app for a studio or agency](https://meadowstack.com/examples/agency-capacity-planning/) | Tasks |
| [An app for a sports club](https://meadowstack.com/examples/sports-club-court-bookings/) | Front desk |
| [An app for a construction company](https://meadowstack.com/examples/construction-site-management/) | Site diary, Drawings |
| [An app for one person](https://meadowstack.com/examples/personal-app-for-a-creator/) | Brand deals, Content, Training |

Read from the demo's source when the site was built: 5 of 9 example apps render <Composer>, in the modules named here as each app's sidebar names them.

## How the starter calls it

*The comment box under a purchase request's history: a Field with a visible label, and the text cleared only after onSend succeeds.*

From `templates/starter/src/modules/requests/components/request-record.tsx` in the Meadowstack repository:

```tsx
function CommentBox({ onSend }: { onSend: (text: string) => Promise<void> }) {
  const [text, setText] = useState("");
  return (
    <Field label="Comment">
      <Composer
        value={text}
        onValueChange={setText}
        placeholder="A question or a note for the others"
        onSend={async (value) => {
          await onSend(value);
          setText("");
        }}
      />
    </Field>
```

## Questions

### Which shortcut sends a comment?

Cmd+Enter on a Mac and Ctrl+Enter elsewhere; the key cap appears beside the send button once there is text. A chat can send on Enter instead.

### What happens to the text if sending fails?

It stays in the box. The send button shows a spinner until the request settles, the box clears only when it succeeds, and the demo adds a toast saying the text is still there.

### Why is the send button inside the box?

So the box and its action read as one control and no row of buttons sits under the text. The history above it stays calm, and the same box works in a comment, a chat and the assistant.

### Can people mention a record in a comment?

Yes. Pass the app's records as mentions, and typing @ offers them, so a comment links the site, order or task it talks about.

## Related

- [AuditTimeline: a record's history and comments](https://meadowstack.com/components/audit-timeline/) (Components)
- [The audit trail](https://meadowstack.com/patterns/audit-trail/) (Patterns)
- [From Access or FileMaker to a web app](https://meadowstack.com/from/access-filemaker/) (Moving from)
- [An app for a construction company](https://meadowstack.com/examples/construction-site-management/) (Example app)
- [An app for a packaging and print company](https://meadowstack.com/examples/packaging-print-production/) (Example app)
- [An app for an accounting office](https://meadowstack.com/examples/accounting-office-documents/) (Example app)
