Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Android docs
AIAndroid

Stream message

Show an assistant reply with one concise status announcement.

Public APILumenStreamMessageAndroid / Compose

Native example

Use Stream message

Update statusLabel with the status, such as "Writing…" then "Done". Put message actions in actions and source citations in sources.

Stream message rendered in the Android phone emulator Lumen playground
Captured exampleAndroid phone emulatorView dark appearance
kotlin
import androidx.compose.foundation.layout.*
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import com.santi020k.lumen.*

@Composable
fun StreamedAnswerExample(answer: String, streaming: Boolean) {
    var feedback by remember { mutableStateOf<LumenMessageFeedback?>(null) }

    LumenStreamMessage(
        statusLabel = if (streaming) "Writing…" else "Answered in 4 seconds",
        status = if (streaming) LumenStreamStatus.Streaming else LumenStreamStatus.Complete,
        actions = {
            LumenMessageActions(
                messageId = "answer-1",
                copyValue = answer,
                feedback = feedback,
                onFeedback = { _, next -> feedback = next },
                disabled = streaming
            )
        },
        sources = { LumenSourceCitation("Lumen docs", "https://lumen.santi020k.com/docs") }
    ) {
        Text(answer)
    }
}
Android
An assistant reply without a bubble, followed by a status line that announces changes politely, optional actions, and optional sources.

Reference

Public API

The primary shared and platform-specific options exposed by LumenStreamMessage.

APIValues or typeDefaultDescription
status / statusLabel / labelstream status / announced text / accessible nameidle / required / AssistantUpdate statusLabel with the status, such as "Writing…" then "Done".

Native behavior

Design and accessibility

When to use it

Update statusLabel with the status, such as "Writing…" then "Done". Put message actions in actions and source citations in sources.

Accessibility

Announces the status label once per change; streamed text never announces.

Shared component

Available on other platforms

React NativeApple / SwiftUI Web
Android docsCompose module