Skip to content

add guide on authoring components#961

Merged
wrenj merged 1 commit intogoogle:mainfrom
wrenj:authc
Mar 24, 2026
Merged

add guide on authoring components#961
wrenj merged 1 commit intogoogle:mainfrom
wrenj:authc

Conversation

@wrenj
Copy link
Copy Markdown
Collaborator

@wrenj wrenj commented Mar 24, 2026

No description provided.

Copy link
Copy Markdown
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 a new comprehensive guide for authoring custom A2UI components, focusing on Angular implementation, schema definition, client-side registration, and agent invocation. The guide has been integrated into the documentation navigation. Feedback includes making the JSON schema example a valid, complete JSON object and correcting a link to point to the client-side rizzcharts example for consistency.

Comment on lines +27 to +102
"Chart": {
"type": "object",
"description": "An interactive chart that uses a hierarchical list of objects for its data.",
"properties": {
"type": {
"type": "string",
"description": "The type of chart to render.",
"enum": [
"doughnut",
"pie"
]
},
"title": {
"type": "object",
"description": "The title of the chart. Can be a literal string or a data model path.",
"properties": {
"literalString": {
"type": "string"
},
"path": {
"type": "string"
}
}
},
"chartData": {
"type": "object",
"description": "The data for the chart, provided as a list of items. Can be a literal array or a data model path.",
"properties": {
"literalArray": {
"type": "array",
"items": {
"type": "object",
"properties": {
"label": {
"type": "string"
},
"value": {
"type": "number"
},
"drillDown": {
"type": "array",
"description": "An optional list of items for the next level of data.",
"items": {
"type": "object",
"properties": {
"label": {
"type": "string"
},
"value": {
"type": "number"
}
},
"required": [
"label",
"value"
]
}
}
},
"required": [
"label",
"value"
]
}
},
"path": {
"type": "string"
}
}
}
},
"required": [
"type",
"chartData"
]
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The JSON snippet for the Chart component is not a valid JSON object on its own, as it's a fragment (a key-value pair) rather than a complete object. This can be confusing for readers trying to understand or validate the schema. To make it a valid and self-contained example, it should be wrapped in curly braces {}.

{
  "Chart": {
    "type": "object",
    "description": "An interactive chart that uses a hierarchical list of objects for its data.",
    "properties": {
      "type": {
        "type": "string",
        "description": "The type of chart to render.",
        "enum": [
          "doughnut",
          "pie"
        ]
      },
      "title": {
        "type": "object",
        "description": "The title of the chart. Can be a literal string or a data model path.",
        "properties": {
          "literalString": {
            "type": "string"
          },
          "path": {
            "type": "string"
          }
        }
      },
      "chartData": {
        "type": "object",
        "description": "The data for the chart, provided as a list of items. Can be a literal array or a data model path.",
        "properties": {
          "literalArray": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "number"
                },
                "drillDown": {
                  "type": "array",
                  "description": "An optional list of items for the next level of data.",
                  "items": {
                    "type": "object",
                    "properties": {
                      "label": {
                        "type": "string"
                      },
                      "value": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "label",
                      "value"
                    ]
                  }
                }
              },
              "required": [
                "label",
                "value"
              ]
            }
          },
          "path": {
            "type": "string"
          }
        }
      }
    },
    "required": [
      "type",
      "chartData"
    ]
  }
}


Once the component is implemented, register it in your client catalog. This maps the component name (used by agents) to the implementation class.

In the [`rizzcharts`](../../samples/agent/adk/rizzcharts/README.md) example, this is done in [`catalog.ts`](../../samples/client/angular/projects/rizzcharts/src/a2ui-catalog/catalog.ts).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The link to the rizzcharts example points to the agent-side README, but the catalog.ts file being discussed is part of the client-side implementation. For consistency and to avoid confusion, it's better to link to the client-side rizzcharts README, similar to the link on line 111.

Suggested change
In the [`rizzcharts`](../../samples/agent/adk/rizzcharts/README.md) example, this is done in [`catalog.ts`](../../samples/client/angular/projects/rizzcharts/src/a2ui-catalog/catalog.ts).
In the [`rizzcharts`](../../samples/client/angular/projects/rizzcharts/README.md) example, this is done in [`catalog.ts`](../../samples/client/angular/projects/rizzcharts/src/a2ui-catalog/catalog.ts).

@wrenj wrenj merged commit 3ef981f into google:main Mar 24, 2026
10 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in A2UI Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants