Skip to main content

Customize AGG UI

AGG UI is designed to be embedded in partner apps without forking components. The supported customization surface is:
  • CSS variables on the AGG root for brand, typography, radius, shadow, and z-index tokens
  • AggProvider config for theme mode, labels, formatting, feature flags, search wiring, and wallet actions
  • component className / classNames props for layout composition
Import @agg-build/ui/styles.css once, then load your app CSS after it. AGG defaults are low specificity, so :root overrides can work, and .agg-root overrides win because they are closer to the AGG UI tree.

Minimal integration

app/providers.tsx
app/page.tsx
AggProvider renders an .agg-root wrapper around its children. If you pass general.rootClassName, that class is added to the same root so you can scope partner-specific branding without affecting other AGG embeds on the page.

Import order

Load AGG styles first and partner overrides second:
Then put variables in your CSS:
agg-theme.css

Custom fonts

Set the AGG font token on .agg-root. This affects AGG typography utilities, primitives, pages, modals, and portaled surfaces.

Plain CSS

You can also set the token on :root; a value on .agg-root wins if both exist.

Next.js next/font

Expose the generated font variable on an ancestor, then map it into the AGG token.
app/layout.tsx
globals.css

Light and dark themes

general.theme controls the class and data attributes applied to .agg-root. If you ship custom dark tokens, match AGG’s dark selector shape so your values win in dark mode:

Gradients

Keep semantic colors and gradient definitions separate. features.enableGradients controls whether branded surfaces resolve to flat primary colors or gradient tokens.

Public theme tokens

Set these on .agg-root or .agg-root.<your-rootClassName>. Avoid overriding bridge tokens such as --color-agg-*, --text-agg-*, and --font-agg-sans directly. They are generated from the public --agg-* tokens.

Copy and labels

Use general.labels when you need to change user-facing text. Label overrides are deep-merged with AGG defaults, so you only provide the keys you want to replace.
Use labels for product copy. Use CSS variables for visual styling. Use component props for data, callbacks, and layout.

Formatting

Override formatting functions when your app needs a different locale, currency presentation, or date style.

Odds display

formatPercent and formatPrice are two renderings of the same number — both receive a probability between 0 and 1. Discovery surfaces (event tiles, search results, charts) use formatPercent; price surfaces (order book, event page outcome chips, place-order, positions) use formatPrice. To show a single odds convention app-wide, set both to the same function:
formatPrice is optional. Leave it unset to keep the default cents rendering (62.5¢). Two values deliberately stay on the built-in formatters even when formatPrice is set, because neither is a price: the order book spread (a difference between two prices, always in cents) and position PnL percentages.

Layout and slots

Use className / classNames for layout composition, not deep CSS selectors.
Prefer token overrides for colors, fonts, radius, shadows, and other repeated visual decisions. Use slot class names for spacing, containment, sticky behavior, or one-off layout requirements.

Troubleshooting

Make sure @agg-build/ui/styles.css is imported before your app CSS, and set --agg-font-family-sans on .agg-root. With next/font, put the generated font variable on an ancestor of AggProvider.
Scope variables to .agg-root and pass a stable general.rootClassName if you have multiple embeds. AGG portaled surfaces also carry .agg-root, so the same scoped token block applies.
Add a dark-mode override block using AGG’s selector shape. Light tokens and dark tokens are separate.
AGG internals use AGG token utilities. Override --agg-* variables for global theming, and use documented className / classNames props for layout slots.

Storybook Customization

Interactive token guide and live component catalog.

Theme Studio

Import a URL, inspect extracted brand tokens, and export CSS.

Setup Guide

Provider setup for SDK, hooks, UI components, and auth.

Components Overview

Curated references for pages, trading surfaces, events, and auth UI.