# ComposeBox

> Props, styling and a live ComposeBox example.

`ComposeBox` from `@polymorfa/react`. Choose props and styles above; the preview stays visible in every code view.

## Props

| Prop | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `onSent` | `() => void` | Optional |  | Called after a send. |
| `className` | `string` | Optional |  | Class for the root. |
| `classNames` | `SlotClassNames` | Optional |  | Classes keyed by slot. |
| `attachments` | `boolean` | Optional | `true` | Offer file attachments: the attach button, drop and paste. Defaults to `true`. Turn it off when the composer's actions have no upload adapter. |
| `accept` | `string` | Optional |  | File types the attach button offers, as for `<input accept>`. |
| `attachmentKinds` | `readonly AttachmentKind[]` | Optional |  | Offer named file types. Omit to keep the single file picker. |
| `multiple` | `boolean` | Optional | `true` | Allow picking several files at once. Defaults to `true`. |
| `conversation` | `ConversationController` | Optional |  | Resolves the reply banner's quoted message. |
| `messages` | `readonly ConversationMessage[]` | Optional |  | Resolves the reply banner's quoted message without a controller. |
| `placeholder` | `string` | Optional | Locale text | Replaces the locale's `composer.placeholder`. |
| `startActions` | `ReactNode` | Optional |  | Rendered in the toolbar before the built-in buttons. |
| `endActions` | `ReactNode` | Optional |  | Rendered after the message field, before the send or mic button. |
| `emoji` | `boolean` | Optional | `true` | Show the emoji picker button. Defaults to `true`. |
| `voiceNotes` | `boolean` | Optional | `true` where supported | Show the voice note button. Defaults to `true` where the browser has `MediaRecorder` and `getUserMedia`. |
| `voiceNoteAutoSend` | `boolean` | Optional | `true` | Send a voice note as soon as it finishes uploading. Defaults to `true`. |
| `quickReplies` | `readonly QuickReplyOption[]` | Optional |  | Options for the "/" quick reply menu. |
| `onQuickReply` | `(option: QuickReplyOption) => void` | Optional |  | Called after a quick reply's text is inserted. |
| `maxRows` | `number` | Optional | `8` | Rows the message field grows to before it scrolls. Defaults to 8. |
| `controller` | `MessageComposerController` | Optional |  | Composer state. |
| `createController` | `() => MessageComposerController` | Optional |  | Factory for a controller the component owns. |

## Types

Named types used in the props above.

```ts @polymorfa/ui
type AttachmentKind =
  | "image"
  | "video"
  | "audio"
  | "document";
```

## Styling

Use `className`, `classNames` (a class for any [slot](https://docs.polymorfa.com/ui-kit/appearance#slots), typed `SlotClassNames`), appearance variables and element styles. The Style panel applies changes to the live component. See [Appearance](https://docs.polymorfa.com/ui-kit/appearance).

## Setup

Use [the provider and server route](https://docs.polymorfa.com/ui-kit/setup) for your application. The preview above uses local sample data and controllers. [Chat controllers](https://docs.polymorfa.com/ui-kit/chat#controllers) and [inbox data sources](https://docs.polymorfa.com/ui-kit/inbox#data-sources) keep your data separate from the UI.
