Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Android docs
AIAndroid

Prompt composer

Collect a prompt with send and stop actions.

Public APILumenPromptComposerAndroid / Compose

Native example

Use Prompt composer

The host owns the text and clears it after submit. Send is disabled until the trimmed prompt fits maxLength; Stop appears only while pending.

Prompt composer rendered in the Android phone emulator Lumen playground
Captured exampleAndroid phone emulatorView dark appearance
kotlin
import androidx.compose.runtime.*
import com.santi020k.lumen.*

@Composable
fun AskExample(send: (String) -> Unit, cancel: () -> Unit) {
    var prompt by remember { mutableStateOf("") }
    var pending by remember { mutableStateOf(false) }

    LumenPromptComposer(
        value = prompt,
        onValueChange = { prompt = it },
        onSubmit = { text -> send(text); prompt = ""; pending = true },
        label = "Ask Lumen",
        pending = pending,
        onStop = { cancel(); pending = false },
        actions = {
            LumenIconButton(
                name = LumenIconName.Paperclip,
                contentDescription = "Attach a file",
                onClick = {},
                size = LumenControlSize.Sm
            )
        }
    )
}
Android
A controlled multiline prompt field with send and stop inside its frame; the host clears the text after `onSubmit` receives the trimmed prompt.

Reference

Public API

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

APIValues or typeDefaultDescription
value / maxLength / pendingcontrolled text / character limit / show stoprequired / 4000 / falseThe host owns the text and clears it after submit.

Native behavior

Design and accessibility

When to use it

The host owns the text and clears it after submit. Send is disabled until the trimmed prompt fits maxLength; Stop appears only while pending.

Accessibility

Visible label, named send and stop buttons, busy while pending.

Shared component

Available on other platforms

React NativeApple / SwiftUI Web
Android docsCompose module