generative-mui — Material UI renderer for A2UI (v0.9.1) #2083
Replies: 6 comments 2 replies
|
cc @ditman @yjbanov — sharing this here as suggested in the submission guide. The companion PR that adds it to the community renderers list is #2082 (CLA green, review feedback applied). Happy to adjust anything — feedback very welcome, and thanks for maintaining A2UI! 🙏 |
|
Hey @yessGlory17! Thanks for building this and showing it, I think it's great! I've noticed that you have a dependency on QQ I didn't have time to fully review your code; how reusable is your core package? could you build mui for other frameworks (like Lit) or is it a react-only thing? |
|
Thanks @ditman, really glad you like it! 🙏 On Zod — it's a hard
On core reusability — this is the fun part: it's React-free by construction (enforced by
So yes — you could absolutely build a Lit (or Vue/Svelte/Angular) renderer on top of |
I'm actually working on this right now on the a2ui-project/a2ui renderers themselves; I'm trying to figure out how to add unit tests to ensure our stuff works with both Zod versions.
This is very cool, can you explain the relationship between |
|
Great question — let me answer it directly. Short answer: no, I don't depend on
Why I went parallel: the core design choice is "Zod as the single source of truth." web_core takes the TS-interfaces + runtime-guards route; in mine, each component's Zod schema is the one source, and two things derive from it: (1) runtime validation of untrusted agent output, and (2) the agent tool JSON Schema handed to the LLM ( On convergence: since web_core is the canonical framework-agnostic core, the "shared core across renderers" idea you raised makes a lot of sense to me. Two directions, and I'm open to both:
On Zod v3+v4 testing — I'm in exactly the same spot right now (dropping |
Even though I like a single source of truth, I don't think we can drop the JSON Schema definitions, because those are used by other frameworks (like python or dart/flutter), so making this zod-first makes it harder to consume by other frameworks without post-processing (maybe z.toJSONSchema is an easy way to produce the JSON from Zod and this would be a moot problem). Have you experimented generating the Zod code from the JSON Schemas? (In my opinion) that should be more straightforward maybe? I've never tried this though! In any case, I think we should create an isue for A2UI to remove the duplicity of zod and json either way; this is feedback that we've received previously! |
Uh oh!
There was an error while loading. Please reload this page.
Hi A2UI community! 👋
I built generative-mui, a community-maintained A2UI renderer that maps A2UI surfaces onto Material UI (MUI) — as far as I can tell, the first MUI renderer in the ecosystem. The agent emits A2UI (a flat, id-referenced adjacency list + a JSON-Pointer-bound data model) and the library renders it as real MUI components inside your app's existing
<ThemeProvider>. The surface has no theme of its own, so it inherits your palette/typography and re-skins top-to-bottom when you switch themes.Links
Spec support
What it does
Text→Typography,Row/Column→Stack,Buttonwithchecks→disabled,Modal→Dialog, …).LineChart/BarChart/PieChart/Gauge/SparkLinevia@mui/x-charts, plusTable,Alert,Chip,Accordion,Stepper,Switch,Rating,Autocomplete, and more. The schemas live in the React-free core, so only the renderers (and the@mui/x-chartsdep) are opt-in.{"path":"/field"}read/write the data model;Button.checks(required,regex) disable the button and surface the first error as helper text.Skeletonplaceholders, append-only string-delta detection so a growing stream never clobbers local edits, cycle/MAX_RENDER_DEPTHguards, and a per-node error boundary.sx/style/classNamefrom the agent never reach MUI; localregexhas ReDoS length caps.Architecture
Two packages with a lint-enforced one-way dependency (
core ← react):@yessglory/generative-mui-core— framework-neutral A2UI v0.9.1: Zod schemas, JSONL parser, JSON-Pointer, a deterministic subscribableSurfaceStore, value resolution, and provider-agnostic agent tool schemas. Imports no React/MUI, so it runs on server/edge/RSC.@yessglory/generative-mui-react— the MUI adapter, exposed as a single<A2uiSurface>component.Install
pnpm add @yessglory/generative-mui-react # core comes with itThe repo ships two runnable examples (Vite SPA and Next.js App Router) that work out of the box in demo mode with no API key. Feedback and issues very welcome — thanks for building A2UI! 🙏
All reactions