Prompt composer
Where a person writes to the on-device model: a growing field, attachments, the model badge and a send key that becomes stop while it answers.
Install
npx ondai add prompt-composerUsage
import { PromptComposer } from '@/components/ondai/prompt-composer'
<PromptComposer onSubmit={chat.send} busy={chat.isBusy} onStop={chat.stop} onAttach={pickPhoto} attachments={files} onRemoveAttachment={removeFile} />- Enter sends on web and hardware keyboards; Shift+Enter adds a line.
- While
busy, the raised send key becomes a stop key.
Customize
Every AI component takes the same look and customization props, so it fits your app rather than ours.
<PromptComposer
variant="pop"
tint="#FF5A5F"
size="lg"
radius={12}
icons={{ attach: Search, send: null }}
labels={{ placeholder: '…', canSend: '…' }}
/>| Prop | What it does |
|---|---|
variant | The look of the whole component: clean, minimal, glass, pop, candy, metal, shine |
size | sm, md, lg; type, rows, icons and keys scale together |
tint | Any colour; the variant paints its keys, tiles and glow in it |
radius | Corner radius of the container |
icons | Replace any icon (a lucide component, an element, or null to hide it): attach, send, stop, image, file, remove |
labels | Every visible and spoken string; defaults are exported as promptComposerLabels: placeholder, canSend, busy, submit, stop |
| Slots | Draw a part yourself: renderAttachment, renderSend |
styles | Style any named part |
Variants
| Prop | Options |
|---|---|
variant | clean, minimal, glass, pop, candy, metal, shine |
size | sm, md, lg |
Fallback
When no provider is ready the component renders the unavailable state (AvailabilityGate copy) and, where a deterministic path exists, keeps working without the model.
Eval score
No model-driven fixtures for this component.
Files
Registry dependencies: button, on-device-badge, surface
npm dependencies: @ondai/tokens, lucide-react-native
Assistant message
One reply from the on-device model: a trace of what it did, the answer streaming in, its sources, and copy or retry. Includes UserMessage for the person's turns.
Inline suggest
A text field that offers the rest of the sentence as ghost text while the person types, from the on-device model. Tab or the Add key takes it.











