Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
React Native docs
AIReact Native

Prompt composer

Collect a prompt with send and stop actions.

Public APILumenPromptComposerReact Native

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 Expo web renderer Lumen playground

Captured exampleExpo web renderer

Open interactive preview
Open the Prompt composer demo
tsx
import { useState } from 'react'
import { LumenPromptComposer } from '@santi020k/lumen-react-native'

export function ChatInput({ onSend }: { onSend: (prompt: string) => Promise<void> }) {
  const [value, setValue] = useState('')
  const [pending, setPending] = useState(false)

  return (
    <LumenPromptComposer
      onStop={() => setPending(false)}
      onSubmit={text => {
        setValue('')
        setPending(true)
        onSend(text).finally(() => setPending(false))
      }}
      onValueChange={setValue}
      pending={pending}
      placeholder="Ask anything"
      submitOnEnter
      value={value}
    />
  )
}
React Native
A controlled composer that hands the trimmed prompt to the host, shows Stop while the answer is pending, and submits on Return.

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

Apple / SwiftUIAndroid / Compose Web
React Native docsNative primitives