Hardcoded Forms are Legacy.
Why show a "Credit Card" form if the user wants to pay with Crypto? Why show a generic dashboard if the user asks "How are my sales in Japan?"
Generative UI means the LLM decides which components to render and how to configure them, in real-time.
02. It's Not Just Text
Using React Server Components (RSC), we can stream a serialized React Component tree from the server to the client. The LLM acts as the router and the prop-builder.
Deep Dive: The Wire Format
RSC payload looks like JSON:
1:I["./app/components/StockCard.tsx", "client", "default"]
It's safe. We aren't injecting raw HTML strings (XSS risk). We are injecting Component References that Hydrate on the client.
message: input,
tools: {'{'}
showStockPrice: {'{'}
generate: (symbol) => <StockCard symbol={symbol} />
{'}'}
{'}'}
{'}'});
{'}'}
03. Accessibility Challenges
Dynamic UI is a nightmare for Screen Readers if you aren't careful. Since the user doesn't know what will appear, you must ensure every generated component announces itself.
Rule: Enforce aria-label in your Zod schemas so the LLM must generate a description.
04. The Senior Engineer's Take
Design Systems are Key.
You cannot let the AI generate raw HTML. It will look terrible and break accessibility.
Instead, feed the AI a strict library of your own high-quality components (Cards, Tables, Charts). The AI becomes the Assembler, not the Designer.