Skip to content

Revamp and expand the theming documentation based on learnings.#809

Open
jgindin wants to merge 6 commits intogoogle:mainfrom
jgindin:theming-docs-update
Open

Revamp and expand the theming documentation based on learnings.#809
jgindin wants to merge 6 commits intogoogle:mainfrom
jgindin:theming-docs-update

Conversation

@jgindin
Copy link
Collaborator

@jgindin jgindin commented Mar 10, 2026

Description

Add a lot more documentation, going into more detail on how theming actually works.

Pre-launch Checklist

  • [x ] I signed the CLA.
  • [ x] I read the Contributors Guide.
  • [ x] I read the Style Guide.
  • I have added updates to the CHANGELOG.
  • [ x] I updated/added relevant documentation.
  • [ x] My code changes (if any) have tests.

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 provides a significant and valuable expansion of the theming documentation. The new guide is much more detailed and provides a clearer step-by-step process for theming. My review includes a few minor suggestions to improve formatting and fix a potentially broken link, ensuring the documentation is as clear and accurate as possible.

Note: Security Review has been skipped due to the limited scope of the PR.

relevant to the specific app or brand (e.g., colors or typography).
>
> ```typescript
> import { cloneDefaultTheme } from "../theme/default-theme.js";
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The relative path ../theme/default-theme.js is likely to result in a broken link when this documentation is rendered on a website. It's also inconsistent with other source code links in this document that use full GitHub URLs. Please replace it with a placeholder or a full URL to the file if it exists in the repository.

Suggested change
> import { cloneDefaultTheme } from "../theme/default-theme.js";
import { cloneDefaultTheme } from "path/to/your/default-theme.js";

jgindin and others added 3 commits March 10, 2026 15:45
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
passed down as **Component Overrides** via the `additionalStyles` record.

**Web (Lit):**
### Dynamic Styles via BeginRenderingMessage
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this the same as above? The 'styles' / 'theme' property on beginRendering / createSurface is defined by the catalog and it's what the agent uses to express 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.

The beginRendering's styles are limited to what's in the catalog's theme?

Hmmm... That's not something I had realized.

Please confirm this and then I'll update the doc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But...I thought that the catalog's theme was meant to provide "hints" for rendering all the components from this catalog, and the beginRendering styles were meant as hints for this particular surface.

E.g., if this surface is rendering some sort of interactive UI for Coca-cola, it would want to use, e.g., it's own color scheme.

styles. On mobile native clients like Flutter, these semantic hints are mapped
directly to global or widget-specific `ThemeData` configurations instead of CSS.

The `Types.Theme` object consists of structurally predefined properties:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I actually think that we should restructure this for v0.9. Having a monolithic theme object for the basic catalog which then has sections for each component makes things less modular. Now if I want to take some components from the basic catalog and use them elsewhere, I need to define some new theme object. Instead, these theme settings should ideally be passed into the constructor of a Component instance when you instantiate it in an app's configuration. E.g. imagine something like:

myNewCatalog = createCatalog({
components: [
  BasicCatalog.Text(defaultSize: 10, color: 0xFFF)
]
})

WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or maybe some CSS mapping should be passed in.

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 absolutely agree that theming should be rethought. This is confusing.

I think we should have a brainstorming session on this ASAP.

@zeroasterisk zeroasterisk added this to the v0.9 stable milestone Mar 11, 2026
A2UI follows a **client-controlled styling** approach, meaning:

- **Agents describe _what_ to show** (components and structure).
- **Clients decide _how_ it looks** (colors, fonts, spacing).
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is up the catalog in a way, no?
A catalog could expose color, font, and spacing params to its components if it wants to.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The catalog can provide theme data, but it's still up to the client to decide how it actually gets applied.

}

// ❌ Bad: Visual properties (not supported)
// ❌ Bad: Visual properties. Breaks responsiveness and brand consistency.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess this addresses my comment above: https://github.com/google/A2UI/pull/809/changes#r2918577043

Here we say you CANNOT do what I suggested there. But this isn't enforced, right? We're just strongly suggesting it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right -- this is bad, but we can't stop someone from building a component that allows these sorts of properties.

`a2ui_client_capabilities.json`). The catalog definition dictates what
components and APIs an agent can use.

**Why would an agent need to send theme properties?** While the client
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this using BeginRenderingMessage.styles?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Most likely, but it could also be the catalog's theme data.

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.

4 participants