You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Docs idea: generative UI in Angular with json-render
#1694
TanStack AI's Angular package covers chat UIs well: injectChat, createChatHook, and widgets as standalone components. One pattern the docs don't show yet is generative UI. In generative UI, the model composes an interface from a catalog of your own components instead of answering in text: a form, a card, or a small dashboard that builds up while the response streams.
I maintain ngx-json-render, an Angular renderer for json-render specs. I tried it with TanStack AI, and the two fit together without any glue package:
Server: a plain chat() call. catalog.prompt() teaches the model the catalog and json-render's streaming format, which is JSONL patches in plain text.
I checked this end to end on an Angular 21 app with @tanstack/ai 0.67.0, @tanstack/ai-angular 0.13.2, and @tanstack/ai-openai 0.29.0. The model was aimock, the same mock your E2E suite uses, replaying a login-form spec in small chunks. The UI built up component by component as the chunks arrived.
Why plain text and not outputSchema: the OpenAI adapter sends structured output with strict: true. OpenAI's strict mode needs additionalProperties: false on every object, but a json-render spec keeps its elements in a map keyed by element id. Plain text works the same on every adapter.
Would a page like this be welcome in the docs? If yes, where should it go? The chat UI recipes are React and built on createChatHook, so a section in the Angular guide or a separate tutorial might fit better. I'm happy to write it as a PR whichever way you prefer.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
TanStack AI's Angular package covers chat UIs well:
injectChat,createChatHook, and widgets as standalone components. One pattern the docs don't show yet is generative UI. In generative UI, the model composes an interface from a catalog of your own components instead of answering in text: a form, a card, or a small dashboard that builds up while the response streams.I maintain ngx-json-render, an Angular renderer for json-render specs. I tried it with TanStack AI, and the two fit together without any glue package:
Server: a plain
chat()call.catalog.prompt()teaches the model the catalog and json-render's streaming format, which is JSONL patches in plain text.Client:
injectChatfrom@tanstack/ai-angular. The client compiles the assistant text that has arrived so far into a spec and hands it to<json-render>:I checked this end to end on an Angular 21 app with
@tanstack/ai0.67.0,@tanstack/ai-angular0.13.2, and@tanstack/ai-openai0.29.0. The model was aimock, the same mock your E2E suite uses, replaying a login-form spec in small chunks. The UI built up component by component as the chunks arrived.Why plain text and not
outputSchema: the OpenAI adapter sends structured output withstrict: true. OpenAI's strict mode needsadditionalProperties: falseon every object, but a json-render spec keeps its elements in a map keyed by element id. Plain text works the same on every adapter.Would a page like this be welcome in the docs? If yes, where should it go? The chat UI recipes are React and built on
createChatHook, so a section in the Angular guide or a separate tutorial might fit better. I'm happy to write it as a PR whichever way you prefer.All reactions