Skip to content

docs: design system integration + custom components guides#824

Draft
zeroasterisk wants to merge 6 commits intogoogle:mainfrom
zeroasterisk:feat/design-system-guide
Draft

docs: design system integration + custom components guides#824
zeroasterisk wants to merge 6 commits intogoogle:mainfrom
zeroasterisk:feat/design-system-guide

Conversation

@zeroasterisk
Copy link
Collaborator

⚠️ DRAFT — Work in progress

What

Two new developer guides and a sample component for the most common A2UI onboarding paths:

Guide 1: Design System Integration

docs/guides/design-system-integration.md

Step-by-step guide for adding A2UI to an existing Angular Material application. Covers:

  • Installing A2UI packages
  • Registering a catalog
  • Adding the chat canvas
  • Connecting to an agent
  • What changes vs. what stays the same

Guide 2: Custom Components (rewritten)

docs/guides/custom-components.md

Complete rewrite replacing the TODO skeleton. Covers:

  • YouTube embed component (new, end-to-end example)
  • Google Maps component (documented from existing rizzcharts)
  • Chart.js component (documented from existing rizzcharts)
  • Data binding with custom components
  • Agent-side catalog configuration
  • "Any component" pattern

New Sample Component

samples/client/angular/projects/rizzcharts/src/a2ui-catalog/youtube.ts

YouTube embed as a custom A2UI component:

  • DomSanitizer for safe iframe URLs
  • 16:9 responsive container
  • Data-bound videoId, title, autoplay properties
  • Material theme integration

Friction Log

docs/guides/friction-log-custom-components.md

8 friction points encountered during development:

  • P2: No getting started guide for custom components (fixed by this PR)
  • P2: Catalog registration pattern is non-obvious (suggest decorator approach)
  • P2: Agent-side catalog config is manual (suggest shared schema)
  • P2: No validation/fallback for unknown component names
  • P2: No upgrade guide for existing apps (fixed by this PR)
  • P3: resolvePrimitive() undocumented
  • P3: DI patterns for custom components
  • P3: Theme token consumption undocumented

TODO (before removing draft)

  • Verify YouTube component builds with ng build rizzcharts
  • Add YouTube to agent-side examples in rizzcharts agent
  • Review friction log items — which should become issues?

…be component

- New guide: design-system-integration.md — step-by-step for adding A2UI
  to an existing Material Angular application
- Rewritten guide: custom-components.md — complete walkthrough for YouTube,
  Maps, and Charts custom components (replaces TODO skeleton)
- New sample component: YouTube embed for rizzcharts catalog
- Updated rizzcharts catalog.ts to include YouTube component
- Friction log documenting 8 friction points (P2/P3) encountered during
  development, with recommendations
- Added Design System Integration to mkdocs nav
@google-cla
Copy link

google-cla bot commented Mar 12, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive documentation for design system integration and custom components, which are crucial for onboarding new developers to A2UI. The new guides are well-structured and provide clear, step-by-step examples. I've included a few suggestions to enhance the accuracy of the documentation and a security recommendation for the new YouTube sample component to ensure agent-provided data is properly validated.

Comment on lines +112 to +116
const id = this.resolvedVideoId();
if (!id) return null;
const autoplay = this.resolvedAutoplay() ? '1' : '0';
const url = `https://www.youtube.com/embed/${encodeURIComponent(id)}?autoplay=${autoplay}&rel=0`;
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The videoId received from the agent is not validated before being used in the YouTube embed URL. While it is URI-encoded, a malicious agent could provide a value that is not a valid YouTube video ID. This could lead to unexpected behavior or attempts to load content from unintended paths on youtube.com. As a security best practice, you should validate that the videoId conforms to the expected format (e.g., using a regular expression).

    const id = this.resolvedVideoId();
    if (!id) return null;

    // Validate the video ID to ensure it's in the expected format.
    const youtubeIdRegex = /^[a-zA-Z0-9_-]{11}$/;
    if (!youtubeIdRegex.test(id)) {
      console.error('Invalid YouTube video ID received from agent:', id);
      return null;
    }

    const autoplay = this.resolvedAutoplay() ? '1' : '0';
    const url = `https://www.youtube.com/embed/${encodeURIComponent(id)}?autoplay=${autoplay}&rel=0`;
    return this.sanitizer.bypassSecurityTrustResourceUrl(url);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, we should do this

@@ -1,83 +1,409 @@
# Custom Component Catalogs
# Custom Components
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom Component Catalogs

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
# Custom Components

Extend A2UI by defining **custom catalogs** that include your own components alongside standard A2UI components.
Extend A2UI with your own components — maps, charts, video players, or anything your application needs.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with a catalog of your own components

## Why Custom Components?

The A2UI Standard Catalog provides common UI elements (buttons, text fields, etc.), but your application might need specialized components:
The A2UI Standard Catalog covers common UI elements (text, buttons, inputs, layout), but real applications need specialized components:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your application might need is better here

- **Brand-specific components**: Custom date pickers, product cards, dashboards
- **Maps**: Google Maps, Mapbox, Leaflet
- **Charts**: Chart.js, D3, Recharts
- **Media**: YouTube embeds, audio visualizers, 3D viewers
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put media at the top of the list

2. **Validate properties**: Always validate component properties from agent messages
3. **Sanitize user input**: If components accept user input, sanitize it before processing
4. **Limit API access**: Don't expose sensitive APIs or credentials to custom components
- `...DEFAULT_CATALOG` — spread the standard catalog so agents can use standard components too
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A2UI ships with a basic catalog to get you started quickly, you do not need to use it if you already have the components you want to render


The agent knows about your custom components through the catalog configuration in its prompt or system instructions.

## More Examples
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think we need a heading here... YouTube and Maps are both examples of adding custom components

};
```

The `DEFAULT_CATALOG` includes all standard A2UI components: Text, Button, TextField, Image, Card, Row, Column, Tabs, Modal, Slider, CheckBox, MultipleChoice, DateTimeInput, Divider, Icon, Video, and AudioPlayer.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add suffix that the basic components are entirely optional if your design system supports A2UI you can expose only your own components, or a mix of basic and custom components

// ... your existing providers (Material, Router, etc.)
configureChatCanvasFeatures(
usingA2aService(MyA2aService),
usingA2uiRenderers(DEFAULT_CATALOG, theme),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not DEFAULT, but custom from material

@@ -0,0 +1,121 @@
# Friction Log: Adding Custom Components to A2UI
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't be a file in this PR and should instead be it's own issue. remove

Comment on lines +112 to +116
const id = this.resolvedVideoId();
if (!id) return null;
const autoplay = this.resolvedAutoplay() ? '1' : '0';
const url = `https://www.youtube.com/embed/${encodeURIComponent(id)}?autoplay=${autoplay}&rel=0`;
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, we should do this

- Remove friction log file (content already in issue google#825)
- YouTube component: add video ID regex validation (security)
- custom-components.md: rename to 'Custom Component Catalogs', reorder
  examples (media first), clarify basic catalog is optional, remove
  redundant heading, fix Maps input.required consistency, add
  encodeURIComponent to docs example
- design-system-integration.md: rewrite to focus on wrapping Material
  components as A2UI components (not using DEFAULT_CATALOG), show
  custom catalog without basic components, add mixed catalog example
- s/standard/basic/ throughout
import { Catalog } from '@a2ui/angular';
import { inputBinding } from '@angular/core';

// No DEFAULT_CATALOG spread — your Material components ARE the catalog
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment for reviewer --- we should probably make this easier for developers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant