A2UI Renderer

Pro

Renders agent-emitted A2UI (v0.9) with Styloviz components: the basic catalog and a dashboard catalog, JSON-Pointer data binding written back as the user edits, catalog functions for validation and formatting, and actions sent back to the agent. Nothing the agent streams ever executes.

</>sv-a2ui-renderer aia2uigenerative-uiagentrendererprotocol
import { SvA2uiRendererComponent } from '@styloviz-pro/a2ui';

Demo & usage

Basic usage

Pro

Usage example — open the gallery for the full interactive demo.

Pro

An interactive demo for this component lives in the gallery.

Open live demo

More examples

Register catalogs once

Pro

Stream JSON Lines into a store

Pro

A catalog of your own

Pro

When to use

  • An agent that should answer with a form, a card or a small dashboard instead of paragraphs describing one.
  • Any A2UI-speaking agent (ADK, LangGraph, CopilotKit…) whose output an Angular app must show in its own design system.
  • For free-form agent text, sv-streaming-markdown is lighter; for tool results the agent did not design, sv-tool-call-card.

Async states

  • loading
  • error
  • retry

Inputs

NameTypeDefaultDescription
loadingbooleanfalseTrue while waiting for the agent's first surface.
errorSvDataError | string | nullnullThe stream failed. Use `toSvDataError()` from `@styloviz/core` to normalise an `HttpErrorResponse`.
messagesreadonly unknown[][]Parsed A2UI messages, in order. Appending re-renders only what the new messages change; replacing the array with one that does not start with the previous messages starts over. Ignored while `store` is set.
storeSvA2uiStore | nullnullA host-owned store from `createSvA2uiStore()` — push a JSON Lines stream into it with `processJsonl()`, share it between renderers, or read its `issues()`. Takes precedence over `messages`.
surfaceIdstring | nullnullThe surface to draw. `null` draws the newest one.
localestringsvLocale()Locale for the catalog's number, currency, date and plural functions.
headingOffsetnumber1How far an agent's heading levels move down: at `1`, its `h1` renders as an `<h2>`, because inside an app page the agent's title is not the page's.
ariaLabelstring''Accessible name for the surface. Falls back to the agent's display name.

Outputs

EventPayload typeDescription
retryvoidThe host should re-open the stream.
actionSvA2uiClientActionA component's `event` action fired — the client message to send to the agent.
issueSvA2uiIssueSomething in the stream could not be used. For the developer console; the user sees a notice in place.

Wire it to your API

This component is headless about transport: it renders what you give it and reports what the user asks for. Nothing below requires @styloviz/data — drive it from whatever you already use.

Template

Pro

Bound to the names this component actually exposes.

Host class

Pro

Drive the three async inputs from your own fetch.

  • This component does not emit a query, so it renders what you give it. Call `load()` on your own trigger and bind `messages`, `loading` and `error`.
  • Normalize failures with `toSvDataError()` from `@styloviz/core`. It derives `retryable` from the status, so a 404 does not get a "Try again" button that can only fail again.

Full walkthrough: Connecting to a backend.

Customization & theming

  • `[messages]` (applied incrementally as the array grows) or `[store]` from `createSvA2uiStore()` for JSON Lines (`processJsonl` / `flush`).
  • `provideSvA2ui({ catalogs, functions, actionHandler, openUrl })` app-wide; `SV_A2UI_BASIC_CATALOG` is always on, `SV_A2UI_STYLOVIZ_CATALOG` adds Badge, Alert, Stat, Progress and Rating.
  • Custom catalog components take one input, `ctx: SvA2uiContext`, and read props through it — literals, bindings (relative inside templates) and function calls resolved for them.
  • `headingOffset` (default 1: an agent's h1 renders as an h2), `locale` for the formatting functions, `surfaceId` to pick one of several surfaces.

Best practices

  • Do: Register only the catalogs you mean to offer. The catalog is the security boundary: an agent can ask only for components the app registered, and a surface naming any other catalog is refused whole — drawn half, it would be an interface the agent did not design.
  • Do: Bind inputs with { "path": "/form/field" }. Edits are written back to the data model, so an action's context — resolved at the moment of the press — carries what is on screen; a literal value is only the starting point.
  • Do: Log (issue). A malformed line, an unknown component or a path into the prototype is reported there and drawn as a notice in place — never thrown, so one bad message cannot blank a surface.
  • Don't: Do not hand the agent's stream to innerHTML or a sanitiser of your own. The renderer never renders markup it did not author: text goes through the kit's Markdown parser, URLs through svIsSafeUrl, and a theme colour must be a hex.
  • Tip: Give the agent catalogs/styloviz.catalog.json (shipped in the package) in its system prompt. It describes exactly the components the renderer draws — a spec holds the two together.

Accessibility

  • The surface is a named region ("Interface from Concierge"), so a screen reader can tell where the agent's interface begins and ends inside the page.
  • Every component is a kit component with its own keyboard model and labels — the A2UI TextField is sv-input-field, ChoicePicker a radio group, checkbox set or pressed chips, Tabs sv-tabs, Modal sv-modal with its focus trap.
  • An icon-only Button takes its name from the component's accessibility.label, else the icon's name; an Image is decorative unless the agent describes it.
  • Heading levels move down by headingOffset so the agent's title does not compete with the page's own h1.
  • Validation messages appear only after the user has changed a field; a disabled button stays focusable through sv-button's own handling.

Feedback on A2UI Renderer

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.