AI Docs
Chat & Streaming
Transports
Structured Outputs
Tools
Middleware
UI
Chat UI Recipes
Interrupts
MCP
- MCP Server ToolsUpdated
- Managed MCP with chat()Updated
- Manual MCPUpdated
- MCP Type GenerationUpdated
- MCP Client InputUpdated
- MCP Server Tools: AdvancedNew
- MCP EventsNew
- MCP AppsUpdated
- Serve Tools over HTTPUpdated
- Serve Resources and PromptsUpdated
- Ask for InputUpdated
- Draft Text from a ToolUpdated
- MCP Server TasksUpdated
- MCP Server AuthUpdated
- MCP Server SessionsUpdated
- MCP Server on stdioUpdated
Persistence
Persistence (Advanced)
Media
- GenerationsUpdated
- Realtime Voice ChatUpdated
- Text-to-SpeechUpdated
- TranscriptionUpdated
- Transcription: AdvancedNew
- Voice CreationUpdated
- Audio RecordingUpdated
- Audio GenerationUpdated
- Image GenerationUpdated
- Image Generation: AdvancedNew
- Video GenerationUpdated
- Video Generation: AdvancedNew
- Live GenerationUpdated
- World GenerationUpdated
- Generation HooksUpdated
Embeddings
Reranking
Evaluate
Code Mode
Sandboxes
- OverviewUpdated
- Quick StartUpdated
- ProvidersUpdated
- HarnessesUpdated
- Harness AuthUpdated
- WorkspaceUpdated
- ToolsUpdated
- PolicyUpdated
- Lifecycle & SnapshotsUpdated
- Portable SnapshotsUpdated
- Keep Files After ReloadUpdated
- Save a Named VersionUpdated
- Branch From a VersionUpdated
- Send a Frozen FileUpdated
- Let the Agent Save and ForkUpdated
- Pick Which Files to KeepUpdated
- What a Snapshot StoresUpdated
- Instance DurabilityUpdated
- Durable RunsUpdated
- EventsUpdated
Sandboxes (Advanced)
Advanced
- Runtime ContextUpdated
- Bring Your Own KeyUpdated
- Debug LoggingUpdated
- Multimodal ContentUpdated
- Files APIUpdated
- Per-Model Type SafetyUpdated
- Runtime Adapter SwitchingUpdated
- Tree-ShakingUpdated
- Extend AdapterUpdated
- Extend Adapter: AdvancedNew
- Typed Pre-Configured OptionsUpdated
- Test with a Fake ModelUpdated
- Prompt CachingUpdated
- Mid-Conversation ChangesUpdated
- Approval Flow ProcessingUpdated
AI/LLM: This documentation page is available in plain markdown format at/ai/latest/docs/ui/custom-adapters.md
UI
Custom Chat UI Adapters
Build a chat UI adapter on @tanstack/ai-client/ui. That subpath exports the types and selectors. Your adapter adds the components.
What the core gives you#
Import from @tanstack/ai-client/ui, not from the main client entry:
- selectChatUI: matches tool results to tool calls, and splits list interrupts from inline interrupts.
- partTypeToKey: turns a part type such as tool-call into a map key such as toolCall.
- Option types for tools, generic interrupts, and outputSchema.
What your adapter owns#
- Native components and context.
- Native reactivity.
- Render callbacks, slots, or snippets.
- Development warnings for missing map keys.
Do not add default markup. Do not add a new store. The app owns the chat instance, from useAppChat in createChatHook, or from useChat or createChat.
Build it#
- Call selectChatUI({ messages, interrupts, inlineToolNames }).
- In automatic traversal, skip a tool-result part only when matched is true. Keep unmatched results.
- Warn once for each missing runtime key in development. Each build tool detects development mode in a different way, so the adapter prints the warning.
- Match the public names of the existing adapters: Chat, Provider, Messages, Message, Part, Interrupts, Interrupt, useChatContext, and createChatHookContexts.
The React, Solid, Vue, Svelte, and Remix adapters show those names in use.