> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Theming overview

Set your brand colors in JavaScript and every SuperDoc component updates: toolbar, comments, dropdowns, everything. For a five-minute walkthrough, see [Getting Started > Theming](https://docs.superdoc.dev/getting-started/theming.md).

```javascript theme={null}
import { createTheme } from 'superdoc';

const theme = createTheme({
  colors: { action: '#6366f1', bg: '#ffffff', text: '#1e293b', border: '#e2e8f0' },
  font: 'Inter, sans-serif',
});

document.documentElement.classList.add(theme);
```

Five properties theme the entire UI.

## Optional layered stylesheet

Default usage remains:

```javascript theme={null}
import 'superdoc/style.css';
```

If your application uses CSS cascade layers and you want explicit layer ordering, use:

```css theme={null}
@layer reset, superdoc, app;
@import 'superdoc/style.layered.css';
@import 'your-app.css' layer(app);
```

## `createTheme()`

Pass a config object, get back a CSS class name. Apply it to `<html>`.

```javascript theme={null}
import { createTheme } from 'superdoc';

const theme = createTheme({
  name: 'my-brand',               // optional: generates sd-theme-my-brand
  font: 'Inter, sans-serif',
  radius: '8px',
  colors: {
    action: '#6366f1',             // buttons, links, active states
    actionHover: '#4f46e5',
    bg: '#ffffff',                 // panels, cards, dropdowns
    text: '#1e293b',               // primary text
    textMuted: '#64748b',          // secondary text
    border: '#e2e8f0',             // all borders
  },
  // Escape hatch: any CSS variable
  vars: {
    '--sd-ui-toolbar-bg': '#f8fafc',
    '--sd-ui-comments-card-bg': '#f0f0ff',
  },
});

document.documentElement.classList.add(theme);
```

`colors` controls the semantic tier: every component inherits from it. The `vars` escape hatch lets you set any `--sd-*` CSS variable directly for fine-grained control.

## SSR support

Use `buildTheme()` to get the raw CSS string for server-side rendering:

```javascript theme={null}
import { buildTheme } from 'superdoc';

const { className, css } = buildTheme({
  colors: { action: '#6366f1', bg: '#ffffff', text: '#1e293b' },
});

const html = `
  <html class="${className}">
    <head><style>${css}</style></head>
    <body><div id="editor"></div></body>
  </html>
`;
```

## Preset themes

Three presets ship out of the box. Add the class to `<html>`: some SuperDoc elements (popovers, dropdowns) are appended to `<body>`, so they need to inherit from `<html>`.

> [card] Docs
>
> Google Docs aesthetic. Clean blues, compact toolbar, subtle shadows.
>
> ```html theme={null}
> <html class="sd-theme-docs">
> ```

> [card] Word
>
> Microsoft Word aesthetic. Fluent-style borders and surfaces.
>
> ```html theme={null}
> <html class="sd-theme-word">
> ```

> [card] Blueprint
>
> High-contrast technical preset. Teal accents, structured layout.
>
> ```html theme={null}
> <html class="sd-theme-blueprint">
> ```

## CSS variables (advanced)

`createTheme()` generates CSS variables under the hood. You can also set them directly:

```css theme={null}
:root {
  --sd-ui-action: #6366f1;
  --sd-ui-bg: #ffffff;
  --sd-ui-text: #1e293b;
  --sd-ui-border: #e2e8f0;
  --sd-ui-font-family: Inter, sans-serif;
}
```

See the [full variable reference](https://docs.superdoc.dev/editor/theming/custom-themes.md#variable-reference) for every token.

## Next steps

> [card] [Custom themes guide](https://docs.superdoc.dev/editor/theming/custom-themes.md)
>
> Full API reference, dark theme starter, all CSS variables by component.

> [card] [Migration guide](https://docs.superdoc.dev/editor/theming/css-variable-migration.md)
>
> Old-to-new variable name mapping. Backward compatibility details.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.