docs/guides/theming.md
Customize the look and feel of A2UI components to match your brand.
A2UI follows a client-controlled styling approach:
This ensures:
A2UI styling works in layers:
flowchart TD
A["1. Semantic Hints
Agent provides hints
(e.g., usageHint: 'h1')"]
B["2. Theme Configuration
You configure
(colors, fonts, spacing)"]
C["3. Component Overrides
You customize
(CSS/styles for specific components)"]
D["4. Rendered Output
Native platform widgets"]
A --> B --> C --> D
Agents provide semantic hints (not visual styles) to guide client rendering:
{
"id": "title",
"component": {
"Text": {
"text": {"literalString": "Welcome"},
"usageHint": "h1"
}
}
}
Common usageHint values:
h1, h2, h3, h4, h5, body, captionThe client renderer maps these semantic hints to actual visual styles based on your theme and design system.
Each renderer provides a way to configure your design system globally, including:
TODO: Add platform-specific theming guides:
Web (Lit):
Angular:
Flutter:
ThemeDataSee working examples:
Beyond global theming, you can override styles for specific components:
Web renderers:
Flutter:
ThemeDataTODO: Add detailed component override examples for each platform.
A2UI renderers typically support automatic dark mode based on system preferences:
prefers-color-scheme)TODO: Add dark mode configuration examples.
A2UI components are responsive by default. You can further customize responsive behavior:
TODO: Add responsive design examples.
Load and use custom fonts in your A2UI application:
TODO: Add custom font examples.
Agents should provide semantic hints (usageHint), never visual styles:
// ✅ Good: Semantic hint
{
"component": {
"Text": {
"text": {"literalString": "Welcome"},
"usageHint": "h1"
}
}
}
// ❌ Bad: Visual properties (not supported)
{
"component": {
"Text": {
"text": {"literalString": "Welcome"},
"fontSize": 24,
"color": "#FF0000"
}
}
}
Define reusable design tokens (colors, spacing, etc.) and reference them throughout your styles for consistency.