Chat

A complete on-device conversation: streamed turns with their trace, stop mid-reply, retry, and history trimmed to the model's context.

Mock· scripted answersNo model runs in a browser, so every answer here is scripted. On a phone it comes from the model.
  • Apple Foundation Models: supported
  • Gemini Nano: supported
  • Llama (not yet supported): not supported
  • A cloud model: supported

Install

npx ondai add chat

Usage

import { Chat } from '@/components/ondai/chat'

<Chat system="You are a helpful assistant inside a notes app. Be brief." suggestions={['Plan a slow Saturday in Lyon', 'What did I note about the budget?']} />
  • Built on useChat() from @ondai/core: history is trimmed to the model context, oldest turns first.
  • Compose your own screen from PromptComposer and AssistantMessage when you need a different layout.

Customize

Every AI component takes the same look and customization props, so it fits your app rather than ours.

<Chat
  variant="pop"
  tint="#FF5A5F"
  size="lg"
  radius={12}
  labels={{ emptyTitle: '…', emptyHint: '…' }}
/>
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
labelsEvery visible and spoken string; defaults are exported as chatLabels: emptyTitle, emptyHint
SlotsDraw a part yourself: renderMessage, renderEmpty, renderSuggestion
stylesStyle any named part

Variants

PropOptions
variantclean, minimal, glass, pop, candy, metal, shine
repliesplain, card
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: assistant-message, prompt-composer, surface

npm dependencies: @ondai/core, @ondai/tokens, lucide-react-native

On this page