#title: views() description: Create and compose view registries for generative UI rendering
views()
Creates an immutable view registry mapping names to Angular components. Views are rendered inline in the chat when the agent produces a JSON spec.
#Usage
Pass to the chat component:
Or provide globally via DI:
#Composition
Compose registries via object spread. Last key wins for overrides:
#Per-View Fallbacks
Each entry can be a bare component or a { component, fallback } object. The fallback mounts while a state-bound prop on the view is still unresolved -- the same shape defineAngularRegistry() accepts:
withViews() and overrideViews() accept the same object form in their addition and override maps.
#API
#views(map)
Creates a frozen ViewRegistry from a Record<string, Type<unknown>>.
| Parameter | Type | Description |
|---|---|---|
map | Record<string, Type<unknown>> | Name → Angular component mapping |
| Returns | ViewRegistry | Frozen immutable registry |
#withViews(base, additions)
Adds new views without overwriting existing entries. Existing keys in base are preserved.
#overrideViews(base, overrides)
Replaces entries in a registry. Keys in overrides win over base. Use this when you want to swap an existing renderer; use withViews when you want to add new node types without touching existing ones.
Returns a new frozen ViewRegistry. The base argument is not mutated.
#withoutViews(base, ...names)
Removes views by name:
#provideViews(registry)
Angular DI provider. Works at app level or route level:
<render-spec> and <render-element> consume VIEW_REGISTRY as a third-priority fallback in registry resolution. The full priority order is: the [registry] template input → RENDER_CONFIG.registry (from provideRender(...)) → VIEW_REGISTRY (from provideViews(...)) → the existing empty fallback. So provideViews(myRegistry) drives rendering when no provideRender({ registry }) is wired and no [registry] input is bound.
#toRenderRegistry(registry)
Converts a ViewRegistry to the low-level AngularRegistry type used by <render-spec>. Called internally by the chat component — most developers won't need this.
#View Components
View components are standard Angular standalone components. They receive props as input() signals:
#How Specs Are Detected
The chat component checks each message for a ui field containing a valid spec:
The type in the spec is matched against the view registry to resolve the Angular component.
#Related
- defineAngularRegistry() -- the low-level
AngularRegistrythattoRenderRegistry()converts aViewRegistryinto - provideRender() -- global render config, including a registry
- Chat generative-UI guide -- wiring
views()into chat so an agent can stream specs that render inline