# MessageComposer API

The following sections document the `MessageComposer` API and its sub-managers.

## Best Practices

- Read the core `MessageComposer` manager first before extending sub-managers.
- Keep custom manager usage consistent across channel and thread composers.
- Avoid bypassing managers when updating composer state.
- Reach for `configuration`, `middleware`, and file helpers only when the manager API is not enough.
- Validate custom data and attachments before composition.
- Document any custom hooks or extensions for future maintainers.

<partial id="shared/chat/js/message-composer/_manager-message-composer"></partial>

## Text Composition With Suggestions

<partial id="shared/chat/js/message-composer/_manager-text-composition"></partial>

## Attachment Management

<partial id="shared/chat/js/message-composer/_manager-attachments"></partial>

## Link Preview Management

<partial id="shared/chat/js/message-composer/_manager-link-previews"></partial>

## Location Composition

<partial id="shared/chat/js/message-composer/_manager-location-composition"></partial>

## Poll Composition

<partial id="shared/chat/js/message-composer/_manager-poll-composition"></partial>

## Custom Data Management

<partial id="shared/chat/js/message-composer/_manager-custom-data"></partial>

## Additional Low-Level Exports

The `stream-chat` message composer barrel exports more than the manager classes documented above. These lower-level APIs are useful when you need custom upload, suggestion, or middleware integrations without deep imports.

| Export group                         | Notable APIs                                                                                                                                                                                                                                                                                                                  | Use when                                                                                                           |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `configuration`                      | `MessageComposerConfig`, `AttachmentManagerConfig`, `TextComposerConfig`, `LinkPreviewsManagerConfig`, `LocationComposerConfig`, `UploadRequestFn`, `MinimumUploadRequestResult`, `DEFAULT_COMPOSER_CONFIG`, and the per-manager default configs                                                                              | You want reusable composer setup, typed custom upload handlers, or access to SDK defaults outside React components |
| `middleware`                         | `TextComposerMiddlewareExecutor`, `MessageComposerMiddlewareExecutor`, `MessageDraftComposerMiddlewareExecutor`, `AttachmentPreUploadMiddlewareExecutor`, `AttachmentPostUploadMiddlewareExecutor`, `PollComposerCompositionMiddlewareExecutor`, `PollComposerStateMiddlewareExecutor`, and the `create*Middleware` factories | You want to replace or extend one stage of the composition pipeline instead of subclassing a full manager          |
| `attachmentIdentity` and `fileUtils` | `isLocalAttachment`, `isUploadedAttachment`, `isSharedLocationResponse`, `isGiphyAttachment`, `isFileReference`, `isFileList`, `createFileFromBlobs`, `readFileAsArrayBuffer`, `generateFileName`, `getAttachmentTypeFromMimeType`, `ensureIsLocalAttachment`                                                                 | You are building custom drag-and-drop, paste, upload, or attachment enrichment flows                               |
| custom typing                        | `LocalAttachment`, `LocalUploadAttachment`, `FileReference`, `UploadPermissionCheckResult`, `TextComposerSuggestion<T>`, and `CustomTextComposerSuggestion`                                                                                                                                                                   | You want end-to-end TypeScript coverage for custom attachments, custom suggestion items, or middleware state       |

You can also type custom suggestion items by augmenting `CustomTextComposerSuggestion`:

```ts
import "stream-chat";

declare module "stream-chat" {
  interface CustomTextComposerSuggestion {
    icon?: string;
    label: string;
  }
}
```

This keeps custom `TextComposer` suggestion payloads typed when you register your own middleware or search source.


---

This page was last updated at 2026-04-13T07:26:58.395Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/sdk/react/v14/components/message-composer/message-composer-api/](https://getstream.io/chat/docs/sdk/react/v14/components/message-composer/message-composer-api/).