# Composer

- **[App UI](/app/)**
- **[Assistant](/app/assistant/)**
- **Composer**

The box a person writes to an assistant in, drawn by ChatComposer (the one chat input): a rounded pill with + for files, attachments as chips and a round send.

## Notes

- **When to use it**: The input box at the bottom of an assistant conversation: a labelled textarea, attachment chips, an attach button and send. Use `app-assistant-thread` for the messages above it; this block only writes, it does not show replies.
- **Writing for it**: - The `label` (40 characters) is invisible but names the textarea for screen readers, so write what the box is for, such as the question being asked, not the word Message.
- Pick `state` to show one situation: filled and over-limit use `value` (up to 1200 characters) as the draft, while ready always starts empty and shows the `placeholder` (80).
- At most 3 attachments, each with a name up to 40 characters and a size text of 20. Fill `counter` and `overLimit` only for the over-limit state, since they show only there.
- **Watch out for**: Enter sends and Shift+Enter adds a line only when a host wires up `onSend`. Without it the hint line is hidden and Attach and Stop stay in the tab order but are marked aria-disabled, so the block on its own is a picture of a composer, not a working one.

## Pairs well with

- **[App, assistant thread](/blocks/app/assistant-thread)**
- **[App, assistant approval](/blocks/app/assistant-approval)**
- **[App, assistant tool call](/blocks/app/assistant-tool-call)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import AppAssistantComposer from '@/components/klarhimmel/blocks/app-assistant-composer';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppAssistantComposer props={{
          "label": "Name who the message goes to",
          "state": "filled",
          "placeholder": "Say what to ask or have done…",
          "value": "Write the request in full, in the person's own words: say what to change, for whom and by when. Then add what to tell the people involved. Finish with any note the next person needs.",
          "attachments": [
            {
              "name": "first-file.pdf",
              "size": "00 KB"
            },
            {
              "name": "second-file.csv",
              "size": "00 KB"
            }
          ],
          "attach": "Attach",
          "send": "Send",
          "stop": "Stop",
          "removeLabel": "Remove",
          "hint": "",
          "counter": "000 / 000",
          "overLimit": "Say by how much it is over and what to do to send it.",
          "notice": "Say why writing is closed and how to carry on."
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## Props

The state prop drives the box: value and attachments are the draft, hint and counter say how to send and how far over, notice explains a disabled box. Send, stop and remove labels are the button words.

- **label**: Text, up to 40 characters.
- **state**: One of 'ready', 'filled', 'sending', 'disabled', 'over-limit'.
- **placeholder**: Text, up to 80 characters.
- **value**: Text, up to 1200 characters.
- **attachments**: List of up to 3. Each item: name, size.
- **attach**: Text, up to 20 characters.
- **send**: Text, up to 20 characters.
- **stop**: Text, up to 20 characters.
- **removeLabel**: Text, up to 20 characters.
- **hint**: Text, up to 120 characters.
- **counter**: Text, up to 20 characters.
- **overLimit**: Text, up to 120 characters.
- **notice**: Text, up to 120 characters.

## Other states

The states of every assistant component, side by side.

- **[Every state](/app/assistant/states)**

## Install

- **CLI**

  ```
  npx shadcn add @klarhimmel/app-assistant-composer
  ```

Uses

- ChatComposer

- **About**: The box a person writes to an assistant in, drawn by ChatComposer (the one chat input): a rounded pill with + for files, attachments as chips and a round send.
- **States**: Ready, filled, sending, disabled, over the limit, drawn by ChatComposer. Enter sends, Shift+Enter adds a line. New project? Set it up once: /get-started/installation.
