Registering a component
After you define a component withdefineComponent(), call registry.register() to add it to the catalog.
defineComponent(), registry.register() throws a ContractError with a fix field telling you to wrap the function first.
Reading the manifest
registry.manifest() returns a JSON string of every registered component and its full props schema. This is the primary interface for AI agents.
type, required, default, enum, and accepts for slot props — so a model receives complete information with no follow-up queries needed.
Registry API
Registers a component in the catalog. The component must be the return value of
defineComponent() — it checks for an internal _isComponent flag. Throws a ContractError if you pass anything else.Returns an array of plain objects, each with a
name string and a props schema object. This is the parsed form of the manifest — useful when you want to work with the data programmatically rather than as a JSON string.Returns a pretty-printed JSON string of
registry.list(). Feed this directly to an AI model’s context window or system prompt so it can discover the available component catalog before generating code.Returns the registered component function for the given display name, or
undefined if no component with that name has been registered. Useful inside the h() compact notation parser and any dynamic composition utilities.Returns
true if a component with the given display name is registered, false otherwise. Use this to guard dynamic lookups before calling registry.get().Why the registry matters for AI generation
Before an AI agent writes any composition code — a page layout, a form, a dashboard — it callsregistry.manifest() to read the complete catalog of available components and their exact prop schemas. With that data in hand, the agent knows which components exist, what props they accept, which props are required, and what values are valid. The result is generated code that references real components with correct prop signatures, rather than hallucinated names or guessed types.
This is the key architectural difference from convention-based frameworks: the registry makes the component surface area machine-readable on demand, at runtime, without a build step.
Self-registering components
The recommended pattern is to have each component file callregistry.register() at the bottom, so importing the file is all you need to register the component.