Summarize

The gist of long text: card, inline, sheet or tooltip. Streams, and map-reduces input that does not fit the on-device 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 summarize

Usage

import { Summarize } from '@/components/ondai/summarize'

<Summarize text={thread.text} presentation="card" length="bullets" emphasis="plain" />
  • Short input streams in one pass; long input is chunked, summarized per chunk and reduced (progress shown).
  • useSummarize() exposes the same logic headlessly.

Customize

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

<Summarize
  variant="pop"
  tint="#FF5A5F"
  size="lg"
  radius={12}
  icons={{ title: Search, run: null }}
  labels={{ title: '…', run: '…' }}
/>
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): title, run, toggle, retry, copy, copied, again, bullet
labelsEvery visible and spoken string; defaults are exported as summarizeLabels: title, run, thinking, reading, idle, retry, copy, copied, again, preparing, tokens, show, hide
SlotsDraw a part yourself: renderBullet, renderSummary, renderEmpty, renderAction, renderError
stylesStyle any named part

Variants

PropOptions
variantclean, minimal, glass, pop, candy, metal, shine
presentationcard, inline, sheet, tooltip
sizesm, md, lg
lengthoneLine, bullets, paragraph
emphasisplain, quote, highlighted

Token budget

Input budget: 3400 tokens. Single streamed pass when the text fits; otherwise map (bullets per chunk) then reduce (streamed).

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

Fixtures: evals/summarize/fixtures.json.

Files

Registry dependencies: button, model-download, on-device-badge, sheet, shimmer-text, skeleton, streaming-text, surface

npm dependencies: @ondai/core, @ondai/tokens, expo-clipboard, expo-haptics, lucide-react-native, react-native-reanimated

On this page