ToonUI

Overview

The best first page for understanding ToonUI, what it does, and the recommended path for learning it without getting lost.

What ToonUI is

ToonUI is a UI language plus rendering runtime for AI products.

It gives the model a constrained way to describe interface intent inside chat or assistant flows.

That means the model can express:

  • cards
  • forms
  • buttons
  • option lists
  • guided next steps
  • structured summaries

But it does not mean the model owns the application.

Why ToonUI exists

Most AI products hit the same wall:

plain text is too weak for good UX, but letting the model generate arbitrary UI code is too risky and too coupled.

That creates a gap.

ToonUI exists to fill that gap with a middle layer:

structured enough to render reliably, simple enough to teach in prompts, and constrained enough to keep product boundaries clean.

The mental model

Think of ToonUI as a contract between the model and your application.

LayerResponsibilityOwned by
LanguageWhat the model is allowed to describe@toon-ui/core
RenderingHow that description becomes React UI@toon-ui/react or @toon-ui/toon-ui
BehaviorWhat happens after the user clicks or submitsYour app

What ToonUI is NOT

ToonUI is NOT:

  • an agent framework
  • a tool executor
  • a backend workflow engine
  • runtime React generation for production
  • a replacement for your design system
  • a way to move business logic into prompts

This boundary matters.

The model paints the interface.

Your app keeps the keys.

Why use ToonUI?

If you are comparing options, this is the question that matters most.

Use ToonUI because it gives your AI product a better interface layer without breaking ownership boundaries.

Better than plain text when interaction matters

Use ToonUI when the assistant should do more than explain.

Examples:

  • compare options
  • ask the user to choose
  • present a short form
  • show next actions clearly
  • guide a decision without making the decision for the user

Safer than generated React at runtime

If the model generates React, you now have code generation concerns mixed with product, security, and rendering concerns.

ToonUI keeps the output at the intent layer.

That makes it easier to:

  • validate
  • render predictably
  • keep design system ownership
  • preserve application boundaries

More teachable than raw JSON contracts

Raw JSON can work, but it often becomes too verbose and too low-level for prompt design.

ToonUI is purpose-built for AI-native UI, so it is easier to teach, inspect, and reason about.

Package overview

PackageWhat it doesBest for
@toon-ui/coreProtocol, catalog, parser, validation, prompts, events, messagesServer-side contract and language rules
@toon-ui/reactExplicit React runtime and adapter APIsFull rendering ownership
@toon-ui/toon-uiMain public client package with default adapterFastest path to integration
@toon-ui/promptsPrompt helpers onlyCustom prompt composition
@toon-ui/cliCLI validation and AST inspectionCI, debugging, and tooling

If you are new, do NOT branch yet.

Use this order:

  1. Start Here
  2. Choose Your Integration Path
  3. Installation
  4. Quickstart
  5. Configuration
  6. Mental Model
  7. Syntax
  8. Node Reference

This gives you a beginning, a middle, and an end.

Read the deep reference pages only AFTER this path.

What to read later

Once the core path is clear, then go deeper:

Fastest working path

  1. Create a protocol on the server with createToonProtocol().
  2. Inject toon.prompt into your system prompt.
  3. Create a client runtime with createToonClient() or createToonReactRuntime().
  4. Render assistant output with ToonMessage or ToonRenderer.
  5. Reinject interactions with toon.messages.toUIMessage(payload) or toon.messages.toModelMessage(payload).

This does NOT force you to use Vercel AI SDK. That is only one possible host-loop integration.

What success looks like

After the quickstart, you should have:

  • a model that can emit ToonUI blocks
  • a client that can render them
  • typed reply and submit payloads
  • a host app that still owns behavior
  • a cleaner AI user experience than plain text alone

Next step

Go to Start Here.

On this page