Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Apple docs
AIApple

Prompt composer

Collect a prompt with send and stop actions.

Public APILumenPromptComposerApple / SwiftUISwift product: LumenUI

Apple availability

Supported native targets

Import LumenUI in the target that uses this component. iPad support follows the iOS package baseline and uses native iPad layout behavior.

iPhone · iOS 16+iPad · iPadOS 16+Mac · macOS 13+Apple Vision · visionOS 1+

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 iPhone simulator Lumen playground
Captured exampleiPhone simulatorView dark appearance
swift
import LumenUI
import SwiftUI

struct ComposerExample: View {
    @State private var draft = ""
    @State private var pending = false

    var body: some View {
        LumenPromptComposer(text: $draft, pending: pending, submitOnEnter: true, onSubmit: { prompt in
            print("Send", prompt)
            draft = ""
            pending = true
        }, onStop: {
            pending = false
        })
    }
}
Apple
A labelled chat prompt field with send and stop actions, controlled through a text binding.

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 NativeAndroid / Compose Web
Apple docsSwiftUI package