Gen UI Demo v0.4.0

Generative UI without generating code

Ask a question. A chain of Claude tool-use calls fetches live data, picks components from a web-component library, and arranges them into a page. The layout rules live in one spec file that both the prompts and the code read: the prompt asks for the pattern, and the code guarantees it. The model never writes code, CSS or sizes.

Or try:

How it works

  1. 1

    Data, then components

    The first model works in a loop. It calls data tools (weather, exchange rates, Wikipedia) and the server returns small, labelled, pre-rounded results. Then it calls one tool per component. Those calls are never executed: the call is the output. A failed data call comes back as data, with an instruction not to fill the gap from memory.

  2. 2

    Structure and roles

    A second model reads the components and decides order, grouping, and what each piece of text is: a card title, a headline figure, body text. It never picks a size. If its answer is missing, malformed, or changes a figure, the first stage's output stands.

  3. 3

    Layout from a closed set

    A third, cheaper model sees one summary line per component, not the markup, and arranges them using six row patterns from the layout spec. The patterns, min-widths and grouping rules in its prompt are generated from the same spec file the code enforces.

  4. 4

    Code passes

    Between and after the model calls, plain code cleans the markup, repairs the layout so it obeys the spec whatever the model returned, and sets type sizes from each role and the width of its slot. These passes are unit tested and run in mock mode too.

  5. 5

    Deterministic render

    The app walks the layout tree and instantiates each web component. Standards-based custom elements, so the same components would work in Vue, Angular or plain HTML.

  6. 6

    Follow-ups and memory

    A last small call suggests three next prompts. The server is stateless: the browser sends back each earlier prompt with a short note of what was shown, and every turn fetches fresh data.

Layout grid, spacing and type scale follow IBM Carbon (2x Grid at the lg breakpoint, productive type tokens), whose Figma kit is free on Figma Community. The components are Shoelace. Open mock mode to see the code passes work without an API key: the canned answer is written with mistakes on purpose.