# Styling

> Customize the appearance of A2UI surfaces with CSS custom properties, fonts, and component-level overrides.

A2UI surfaces support theming through CSS custom properties scoped to the `.a2ui-surface` class.

This page covers the A2UI v0.9 surfaces you render through the `a2ui` prop. To theme the A2UI v1.0 standard components, see [Theming](/generative-ui/components/theming).

## Theme CSS [#theme-css]

Create a theme file and import it in your layout:

```css title="src/a2ui/theme.css"
.a2ui-surface {
  --a2ui-color-surface: #ffffff;
  --a2ui-color-border: #e0e0e0;
  --a2ui-color-muted: #737373;
  --a2ui-color-error: #dc2626;
  --a2ui-primary-color: #111111;
}
```

```tsx title="src/app/layout.tsx"
import "@/a2ui/theme.css";
```

## CSS custom properties reference [#css-custom-properties-reference]

| Variable | Default | Description |
|---|---|---|
| `--a2ui-color-surface` | `#fff` | Card, modal, chip, and button backgrounds |
| `--a2ui-color-border` | `#ccc` | Borders, dividers, and the tab rule |
| `--a2ui-color-muted` | `#666` | Captions and secondary text |
| `--a2ui-color-error` | `red` | Validation errors |
| `--a2ui-primary-color` | `#007bff` | Primary buttons, selected chips, and the active tab |

The built-in components set their own border radius, so there is no radius variable.

<Callout type="info">
These variables are scoped to `.a2ui-surface`, so they won't affect the rest of your app. You can also set them on `:root` if you want global defaults.
</Callout>

## Custom fonts [#custom-fonts]

Override the font family on the surface container:

```css title="src/a2ui/theme.css"
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

.a2ui-surface {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif !important;
  letter-spacing: -0.01em;
}
```

## Image sizing [#image-sizing]

An Image with no `variant` stretches to the width of its container. To keep logos and avatars small, set `variant` to `icon` or `avatar` in the schema, or constrain them with CSS:

```css title="src/a2ui/theme.css"
/* Constrain logos and avatars */
.a2ui-surface img {
  max-width: 28px;
  max-height: 28px;
  border-radius: 4px;
}

/* Smaller status indicator icons */
.a2ui-surface img[alt="On Time"],
.a2ui-surface img[alt="Delayed"] {
  max-width: 10px;
  max-height: 10px;
  border-radius: 50%;
}
```

## Dark mode [#dark-mode]

CopilotKit sets dark A2UI colors for you when `.dark` is on an ancestor of the chat. To use your own dark colors, scope the variables under `.dark`:

```css title="src/a2ui/theme.css"
.dark .a2ui-surface {
  --a2ui-color-surface: #1a1a1a;
  --a2ui-color-border: #333333;
  --a2ui-color-muted: #a3a3a3;
  --a2ui-primary-color: #3b82f6;
}
```

## Full example [#full-example]

Here's a complete theme file combining all the patterns above:

```css title="src/a2ui/theme.css"
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

.a2ui-surface {
  /* Colors */
  --a2ui-color-surface: #ffffff;
  --a2ui-color-border: #e0e0e0;
  --a2ui-color-muted: #737373;
  --a2ui-color-error: #dc2626;
  --a2ui-primary-color: #111111;

  /* Typography */
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif !important;
  letter-spacing: -0.01em;
}

/* Image constraints */
.a2ui-surface img {
  max-width: 28px;
  max-height: 28px;
  border-radius: 4px;
}

/* Dark mode */
.dark .a2ui-surface {
  --a2ui-color-surface: #1a1a1a;
  --a2ui-color-border: #333333;
  --a2ui-color-muted: #a3a3a3;
  --a2ui-primary-color: #3b82f6;
}
```
