Design · December 1, 2026
AI UI Generation Needs a Component Registry, Not a Style Guide
By Hailey Armstrong · Principal UX Designer
The best prompt is still the wrong interface to a design system
Most teams are trying to make AI-generated interfaces consistent by giving the model more instructions. That is the wrong abstraction. A style guide is a reference document; a component registry is a constrained construction kit. Agents are far more reliable when they select from executable building blocks than when they interpret prose and recreate the result from scratch.
This distinction is now supported by controlled research rather than just anecdote. A 2026 CHI study compared three ways to expose a design system to UI-generating agents: putting the complete guide in the instructions, retrieving relevant guidance into context, and assembling pre-built components from a registry. The registry approach reached 95.08% design-system compliance, compared with 84.55% for selective context and 70.98% for instruction-only generation. The study used six real-world screens and 23 component types, so it is not a universal production benchmark. It is, however, a useful signal: moving the agent from “understand and imitate” to “retrieve and compose” changes the reliability profile.
That finding extends the problem described in Component Contracts Are Replacing Design System Documentation. Contracts make individual components checkable. Registries make the right components easy to choose. A serious agent-ready system needs both.
Why prose loses to an executable inventory
A style guide asks an agent to perform several uncertain translations before it can write code:
- Find the relevant rule among unrelated guidance.
- Infer which component the rule applies to.
- Convert visual language into a component API.
- Remember every state, token, and accessibility requirement.
- Reproduce the pattern in the project’s framework.
Each translation is a chance to hallucinate. “Use the primary button for the main action” does not tell an agent whether the allowed prop is variant="primary", tone="brand", or a component imported from a package. “Use a compact field on mobile” does not define the breakpoint, the density token, or the error state.
A registry changes the unit of work. Instead of asking the model to synthesize a button from rules, it exposes a finite set of components with names, imports, variants, examples, and checks. The agent still has to decide whether a button or link is appropriate, but it no longer has to invent the implementation vocabulary.
The difference is similar to compiling against a typed API instead of copying a paragraph from a manual. Documentation can explain intent; a registry can supply a valid artifact.
The CHI study’s comparison is revealing because the registry was not the cheapest strategy. Registry-based generation used more tokens—about 0.38 million on average, versus 0.13 million for context-based generation in the reported experiment—and took about 6.35 minutes, versus 5.55 minutes for context-based generation. Yet the additional retrieval and tool calls bought substantially higher compliance. The practical lesson is not “spend unlimited tokens.” It is “optimize for correction cost, not prompt length.” A slightly more expensive first pass can be cheaper than debugging a visually plausible but structurally wrong interface.
What belongs in a component registry
A registry should expose the smallest complete unit an agent can safely compose. That usually includes the implementation reference, the semantic contract, and the evidence needed to verify the result.
| Registry field | What the agent needs | What CI or a reviewer can verify |
|---|---|---|
| Identity | Canonical name, package, import path | The dependency exists and is approved |
| Composition | Slots, children, allowed nesting | Invalid structures are rejected |
| Variants | Closed values such as primary, quiet, danger | Unknown variants fail type or schema checks |
| States | Hover, focus, disabled, loading, error, selected | Required states have stories or tests |
| Tokens | Semantic color, spacing, typography, and motion references | Raw values and forbidden tokens are detectable |
| Semantics | Native element, accessible name, relationships, keyboard behavior | Accessibility checks can run against a contract |
| Examples | Minimal usage and a representative edge case | Generated code can be compared with fixtures |
| Status | Stable, experimental, deprecated, replacement | Agents stop selecting retired components |
The field that teams most often omit is composition. A button’s colors are easy to describe; the relationship between a dialog trigger, dialog title, description, and action group is harder. An agent can select the right-looking pieces and still produce a flow that lacks a name, traps focus incorrectly, or places a destructive action in the wrong slot.
A registry entry can be represented in JSON or TypeScript. It does not need to become a new universal standard. It needs to be authoritative in one repository and usable by the tools that generate and validate code.
export const ButtonContract = {
name: "Button",
import: "@acme/ui/Button",
element: "button",
variants: ["primary", "secondary", "quiet", "destructive"],
states: ["default", "hover", "focus-visible", "disabled", "loading"],
tokens: ["action.primary", "action.secondary", "text.on-action"],
rules: [
"Use destructive only for irreversible actions",
"Do not use icon-only mode without an accessible label",
],
examples: ["button/primary.tsx", "button/disabled.tsx"],
status: "stable",
} as const;
The closed variant list is more important than the prose rule. If an agent generates variant="danger", the type system should reject it before a human has to notice. The rule still matters because a valid destructive button can be used for the wrong action. A good registry therefore combines machine-enforced constraints with short, intent-bearing guidance.
The registry is not a replacement for a semantic design system
There is a tempting but dangerous interpretation of the CHI result: put every component in a registry and let the agent assemble screens. That creates a component vending machine, not a design system.
The research on Affora, a design system for agent-friendly interfaces, points to the missing layer. Its central claim is that a shared interface must expose interaction meaning: available actions, current state, feedback, and reversal paths should remain recoverable from the interface representation. Affora’s authors explicitly separate measured findings from proposed guidance, and report that visual variation can remain substantial when the semantic structure is preserved. The goal is not to force every product into one visual style. It is to make meaning stable beneath the style.
That has three consequences for a registry.
First, register state transitions, not only snapshots. A component should tell the agent what happens after submit, failure, retry, selection, and cancellation. “Loading” as a color and spinner is not enough; the component should expose whether the action is disabled, whether the request is cancellable, and where the result is announced.
Second, register semantic relationships. A field needs a label and error relationship. A menu needs its trigger and popup relationship. A dialog needs a title and a predictable close path. The W3C’s November 2026 Web Platform Design Principles makes the broader case: features should put user needs first, preserve accessibility by default, and be detectable so content can gracefully fail. Agent compatibility is not an excuse to discard those constraints; it is another reason to make them explicit.
Third, keep the visual layer flexible. The registry should constrain what must be true, not freeze every border radius. This is where agent experience and human experience can reinforce one another. Clear state, stable naming, and explicit affordances help screen readers, keyboard users, test automation, and computer-use agents—even though those audiences are not identical.
DESIGN.md helps agents find intent; it does not provide the whole runtime
The emergence of DESIGN.md shows that teams need a portable visual specification. The DesignSpecs dataset collected 613,207 files named DESIGN.md in October 2026, then filtered them to 36,906 token-bearing files from 15,794 public repositories. The dataset is evidence of demand for a shared file convention, not proof that every file is useful: only files with a valid front matter block, a design-system name, recognized tokens, and zero linter errors entered the final collection.
A DESIGN.md file is valuable for identity and intent. It can tell an agent that the product uses semantic color roles, a particular type scale, a density philosophy, and rules for tone. It is a good front door. But prose plus tokens does not tell the agent which existing component to import, which props are legal, or which interaction states have been implemented.
Use the two artifacts for different jobs:
DESIGN.md: visual identity, principles, token meanings, examples, and project-level defaults.- Component registry: executable inventory, APIs, composition rules, state contracts, and deprecation status.
- Validation layer: type checks, lint rules, accessibility tests, visual regression, and task-level evaluation.
This division also keeps context small. An agent should not receive every component’s full documentation on every task. It should receive project identity, search the registry for candidates, retrieve the few contracts relevant to the task, and then use approved components in generated code.
Build retrieval and validation as one loop
A registry only pays off when the generation path and the enforcement path share the same source. A useful workflow has four stages:
- Classify the request. Extract the screen goal, user action, content state, and risk level. A checkout confirmation and a marketing card should not retrieve the same guidance.
- Retrieve candidates. Search names, descriptions, slots, states, and examples. Return a small set of compatible components rather than the whole library.
- Compose through the public API. Generate imports and props from the registry. Prefer a registry example over a fresh implementation whenever one exists.
- Validate the rendered result. Run types, accessibility checks, token policy, visual snapshots, and a task-oriented interaction test.
The validation stage matters because compliance is not a property of the prompt. The CHI study evaluated generated screens against checklists derived from style-guide requirements, covering attributes such as color, spacing, and state behavior. Teams should adopt the same discipline: translate important design rules into pass/fail checks instead of asking a reviewer to remember them.
request → intent classification → registry retrieval → typed composition
→ render → contract checks → accessibility and visual checks
↖──────────── repair with the failing contract ─────────────↙
Do not feed a failed screenshot back into the model with “make this more like the design.” Return the failing contract: “Dialog is missing an accessible description,” “raw color #2f6 is not an approved semantic token,” or “the loading state leaves the submit action enabled.” Precise failures turn repair into a bounded operation.
Chrome’s November 2026 Modern Web Guidance release demonstrates the same pattern at the platform level. Google reported nearly 1,000 public evaluation runs in which frontier models passed about 60% of modern-web checks without guidance and roughly 80–90% with the guidance installed. The figures come from Google’s own evaluation dashboard, so they should not be treated as an independent benchmark. The architectural point is still useful: current, task-specific guidance plus explicit fallbacks can move agents away from legacy patterns. A design-system registry applies that idea to an organization’s own components.
A practical migration plan
Do not begin by cataloging every component. Start with the paths where generated UI causes the most rework.
Do not measure success by the number of registry entries. Do measure valid composition, correction time, and the rate of generated changes that pass checks on the first or second attempt.
Do not dump your full Storybook into an agent context window. Do create a retrieval index with canonical names, use cases, states, imports, and examples, then fetch the smallest relevant contracts.
Do not expose every internal escape hatch. Do keep the public registry aligned with the supported API and mark exceptions explicitly so agents do not learn unstable implementation details.
Do not make visual matching the only score. Do score semantics, state completeness, token usage, interaction behavior, and visual fidelity separately. Affora’s framing is a useful reminder that appearance can vary while interaction meaning remains stable.
Do not rewrite the design system for an AI demo. Do select five high-frequency components, close their variants, document their state transitions, add executable checks, and run the same generation tasks before and after the registry exists.
The right first milestone is not “the agent can build a page.” It is “the agent can compose five components without inventing an API, bypassing a semantic token, or omitting a required state.” Once that loop is trustworthy, expand the inventory based on observed demand.
The recommendation: make design systems executable, not merely legible
Style guides remain useful. Designers and engineers need principles, rationale, and room for judgment. But prose cannot be the enforcement boundary for machine-generated UI. The evidence from the registry comparison, the agent-friendly interface work, and the growth of structured DESIGN.md files all point toward a layered system.
Keep intent in human-readable documentation. Keep choices and constraints in a searchable registry. Keep correctness in automated contracts and rendered-task tests. That structure gives agents a narrower space in which to make decisions while preserving visual freedom where it does not threaten meaning.
The question for a design-system team is therefore not “How do we prompt the agent to follow our style guide?” It is “Which decisions should the agent retrieve, which should it compose, and which should our build reject?” Answer those three questions, and AI UI generation stops being a styling lottery. It becomes a constrained engineering workflow that can improve as its registry and checks get better.