# Draft Messages

The Compose UI components SDK provides a way to create and manage draft messages.

Drafts are disabled by default. In order to enable this feature, you need to enable it within the `ChannelViewModelFactory` and `MessagesViewModelFactory` factories:

```kotlin {5,10}
MessagesViewModelFactory(
    context = applicationContext,
    channelId = channelId,
    messageId = messageId,
    isComposerDraftMessageEnabled = true,
)

ChannelViewModelFactory(
    chatClient = chatClient,
    isDraftMessageEnabled = true,
)
```

<admonition type="note">

Drafts on Compose UI components are available since version [6.13.0](https://github.com/GetStream/stream-chat-android/releases/tag/v6.13.0).

</admonition>

<admonition type="tip">

Draft messages are synchronized across devices.

</admonition>

## Basic Usage

<partial id="shared/chat/draft-message/_basic-usage"></partial>

## Customization

By default, the only additional UI added to the SDK when drafts are enabled is a preview of the draft message in the channel list. When a draft is saved, the draft message is shown in the channel list until the message is published or deleted. The message composer is populated with the draft message content as well.

### Draft Message on Channel List

The `ChannelList` displays the content of the draft message when it is present instead of the last message received within the channel. The `ChatTheme.messagePreviewFormatter` delegate is used to render this draft message.

```kotlin
messagePreviewFormatter = object : MessagePreviewFormatter {
    [...]
    override fun formatDraftMessagePreview(draftMessage: DraftMessage): AnnotatedString =
        buildAnnotatedString {
            withStyle(style = SpanStyle(color = Color.Blue)) {
                append("Draft message: ")
            }
            append(draftMessage.text)
        }
}
```

## Draft Events

<partial id="shared/chat/draft-message/_events"></partial>

## Draft Messages on GlobalState

<partial id="chat-sdk/android/v6/_partials/common-content/_draft-messages-global-state"></partial>


---

This page was last updated at 2026-04-10T16:24:16.172Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/sdk/android/compose/drafts/](https://getstream.io/chat/docs/sdk/android/compose/drafts/).