OpenUI

Generative UI with a streaming language. A model writes an interface in OpenUI Lang, one line at a time, using only the components you allow. The browser parses every chunk, renders what has arrived, and then runs the state, data fetching and buttons on its own, without asking the model again.

14 lessons in 6 modules, about three hours. Each has animated diagrams, a simulator to try things in, something to break, and a quick check. Checked against @openuidev/react-lang 1.0.1 in October 2026.

Start with lesson 1

How each lesson works

The course follows one loop: see it, try it, break it, explain it.

  1. See itAnimated diagrams of the stream, the parser and the runtime, to play, pause and step.
  2. Try itEdit OpenUI Lang in an in-browser simulator and watch it render as it streams.
  3. Break itWrite the mistakes models make on purpose, and predict what the parser does.
  4. Explain itA quick check, then a paragraph in your own words.

Lessons

  1. Why generate UI?
  2. Library, prompt, stream, render
  3. Reading OpenUI Lang
  4. Streaming and hoisting
  5. When the model gets it wrong
  6. Defining components
  7. The generated system prompt
  8. Reactive state with $variables
  9. Query and Mutation
  10. Actions and onAction
  11. Server tools vs runtime tools
  12. Chat: AgentInterface and the message protocol
  13. Patch, don't regenerate
  14. Production checklist

Also: the playground (the full simulator, with every recorded response), the glossary, and the sources.

Questions asked along the way

Each short answer links to the lesson that answers it properly.

Is this OpenUI's official course?

No. It is an independent course, written by reading OpenUI's source, its documentation and the installed packages, and by running the parser. OpenUI is an MIT-licensed project from Thesys; its own documentation lives at openui.com/docs, and the Spec button in the top bar of every lesson opens it.

What was checked, and against what

Does the course call a real model?

No. Nothing on these pages calls a model or needs an API key. The model's answers are recorded OpenUI Lang responses, replayed character by character by a small simulator so you can watch them stream, pause them, and edit them. The simulator implements a teaching subset of the language and a handful of stock components as plain HTML. The real thing is @openuidev/react-lang, and every lesson says where the subset stops.

Open the playground

How is this different from MCP Apps, or from a JSON spec?

With MCP Apps a tool server ships its own HTML page, shown in a sandboxed iframe. With a JSON spec (json-render, A2UI) the model writes a JSON tree against a catalog of components. OpenUI also uses your components, but the model writes a compact line-by-line language instead of JSON, which OpenUI's own benchmark puts at roughly half the tokens, and each line can render as soon as it arrives.

The four paradigms, sorted

Does the model call my APIs?

It can, in two different ways. Server tools run in your backend while the model is answering, and their values are written into the interface as a snapshot. Runtime tools are written into the interface as Query and Mutation statements and run later in the browser, through the toolProvider you give the Renderer, so the data stays live with no new model turn. Either way, treat the arguments as untrusted input.

Both, side by side

What happens when the model writes something invalid?

The parser is permissive. An unknown component, a missing required argument or a wrong type drops that piece, reports an error code such as unknown-component or missing-required, and renders the rest. Some mistakes are silent: a statement nothing references is never shown and raises no error. Named arguments like gap: "l" are not part of the language; they produce errors, but the messages never mention the colon. The errors can be sent back to the model to fix.

Break it on purpose

Do I need React?

For the stock components and the chat interface, yes: @openuidev/react-lang, @openuidev/react-ui and @openuidev/react-headless are React packages. The parser, prompt generator and runtime live in the framework-agnostic @openuidev/lang-core, which the labs use from plain Node, and OpenUI also has Vue, Svelte and Angular runtimes. This course shows React code, and needs none to follow.

Which package does what

Which versions does the course cover?

@openuidev/lang-core and @openuidev/react-lang 1.0.1 (OpenUI Lang 1.0), with @openuidev/react-ui and @openuidev/react-headless 0.18.1, as of October 2026. Details such as prompt section names and error codes changed between earlier versions of the language.

Sources and versions

How do I run the labs?

The labs are small Node scripts in the openui/ folder of this repository. They use @openuidev/lang-core offline, with recorded model output and no keys. Install once with cd openui && npm install --ignore-scripts (the flag skips the package's install-time telemetry script), then run a lab with node, for example node 01-parse-stream/stream.mjs. Lessons that use a lab show the exact lines.

The first lab, in a lesson