Configuration
Configure ToonUI correctly: one active catalog, one server prompt, one React runtime.
A correct ToonUI setup has three pieces:
- active standard component catalog
- server protocol generated from that catalog
- client runtime registered with matching React components
Active catalog
The catalog is not free-form. Developers select from standard parseable ToonUI components.
const components = ['text', 'card', 'form', 'field', 'button', 'table'] as const;Do not write domain components like delete_product or invoiceSummary. Business intent belongs in button replies, form submits, tools, and application code.
Each key you add has two consequences:
- the server prompt will teach the model that component
- the React runtime must have a registered component for that key
So do not enable chart, dialog, sheet, or table unless your app can actually render them.
For the full official matrix, including required child components, read Catalog.
Server configuration
import { createToonProtocol } from '@toon-ui/core';
const toon = createToonProtocol({ components });createToonProtocol returns:
| Property | Purpose |
|---|---|
prompt | system prompt fragment generated from the active catalog |
rules | structured rules for components and variants |
catalog | active catalog used for prompt generation and validation |
events | helpers for reply/submit payloads |
messages | converters for reinjecting UI interactions into chat/model state |
Client configuration
import { createToonReactRuntime } from '@toon-ui/react';
const toon = createToonReactRuntime({
components: {
text: TextComponent,
card: CardComponent,
form: FormComponent,
field: FieldComponent,
button: ButtonComponent,
table: TableComponent,
},
});createToonReactRuntime creates a runtime that includes:
- the active catalog derived from registered components
- parser and validator helpers
- message/event helpers from core
- React layout and render context
Adapter configuration
Use an adapter when you want coverage metadata or strict validation.
import { createToonReactAdapter, createToonReactRuntime } from '@toon-ui/react';
const adapter = createToonReactAdapter({
level: 'strict',
components: {
text: TextComponent,
card: CardComponent,
form: FormComponent,
field: FieldComponent,
button: ButtonComponent,
table: TableComponent,
},
});
const toon = createToonReactRuntime({ adapter });| Level | Meaning |
|---|---|
minimal | only registered components are available |
strict | throws if required adapter keys are missing |
Dependency validation
Some components require child components:
| Component | Requires |
|---|---|
form | field, button |
list | item |
tabs | tab |
accordion | section |
menu, command | action |
chart | series, point |
breadcrumb | crumb |
If you enable form without field and button, ToonUI throws early. That is intentional.
Common catalog configurations
These are examples, not presets. ToonUI does not export a default UI catalog.
| Goal | Components |
|---|---|
| Text-only answers | text, heading, separator |
| Cards and actions | text, heading, badge, card, button |
| Forms | text, form, field, button |
| Search results | text, list, item, badge, button, empty |
| Exact data | text, table |
| Navigation | breadcrumb, crumb, pagination, menu, command, action |
| Charts | chart, series, point |
| Overlays | text, dialog, sheet, popover, tooltip, button |
Next step
Read Catalog, Core package, and React package.