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.

No model needed

Install

npx ondai add prompt-composer

Usage

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: '…' }}
/>
PropWhat it does
variantThe look of the whole component: clean, minimal, glass, pop, candy, metal, shine
sizesm, md, lg; type, rows, icons and keys scale together
tintAny colour; the variant paints its keys, tiles and glow in it
radiusCorner radius of the container
iconsReplace any icon (a lucide component, an element, or null to hide it): attach, send, stop, image, file, remove
labelsEvery visible and spoken string; defaults are exported as promptComposerLabels: placeholder, canSend, busy, submit, stop
SlotsDraw a part yourself: renderAttachment, renderSend
stylesStyle any named part

Variants

PropOptions
variantclean, minimal, glass, pop, candy, metal, shine
sizesm, 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

On this page